Skip to content

Commit

Permalink
Merge 6c841f1 into 6e81fbe
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmorozov333 authored Jul 2, 2024
2 parents 6e81fbe + 6c841f1 commit 3009074
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void TScanHead::OnIntervalResult(const std::optional<NArrow::TShardedRecordBatch
std::unique_ptr<NArrow::NMerger::TMergePartialStream>&& merger, const ui32 intervalIdx, TPlainReadData& reader) {
if (Context->GetReadMetadata()->Limit && (!newBatch || newBatch->GetRecordsCount() == 0) && InFlightLimit < 1000) {
if (++ZeroCount == std::max<ui64>(16, InFlightLimit)) {
InFlightLimit *= 2;
InFlightLimit = std::max<ui32>(MaxInFlight, InFlightLimit * 2);
ZeroCount = 0;
}
} else {
Expand Down Expand Up @@ -97,7 +97,17 @@ TConclusionStatus TScanHead::Start() {
TScanHead::TScanHead(std::deque<std::shared_ptr<IDataSource>>&& sources, const std::shared_ptr<TSpecialReadContext>& context)
: Context(context)
{
InFlightLimit = Context->GetReadMetadata()->Limit ? 1 : Max<ui32>();
if (!HasAppData() || !AppDataVerified().ColumnShardConfig.HasMaxInFlightIntervalsOnRequest()) {
MaxInFlight = 256;
} else {
MaxInFlight = AppDataVerified().ColumnShardConfig.GetMaxInFlightIntervalsOnRequest();
}

if (Context->GetReadMetadata()->Limit) {
InFlightLimit = 1;
} else {
InFlightLimit = MaxInFlight;
}
while (sources.size()) {
auto source = sources.front();
BorderPoints[source->GetStart()].AddStart(source);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class TScanHead {
ui32 SegmentIdxCounter = 0;
std::vector<TIntervalStat> IntervalStats;
ui64 InFlightLimit = 1;
ui64 MaxInFlight = 256;
ui64 ZeroCount = 0;
bool AbortFlag = false;
void DrainSources();
Expand Down

0 comments on commit 3009074

Please sign in to comment.