@@ -61,8 +61,7 @@ void TScanHead::OnSourceReady(const std::shared_ptr<IDataSource>& source, std::s
6161 AFL_VERIFY (FinishedSources.emplace (frontSource).second );
6262 while (FinishedSources.size () && (*FinishedSources.begin ())->GetFinish () < SortedSources.front ()->GetStart ()) {
6363 auto finishedSource = *FinishedSources.begin ();
64- if (!finishedSource->GetResultRecordsCount () && Context->GetCommonContext ()->GetReadMetadata ()->HasLimit () &&
65- InFlightLimit < MaxInFlight) {
64+ if (!finishedSource->GetResultRecordsCount () && InFlightLimit < MaxInFlight) {
6665 InFlightLimit = 2 * InFlightLimit;
6766 }
6867 FetchedCount += finishedSource->GetResultRecordsCount ();
@@ -75,6 +74,7 @@ void TScanHead::OnSourceReady(const std::shared_ptr<IDataSource>& source, std::s
7574 AFL_NOTICE (NKikimrServices::TX_COLUMNSHARD)(" event" , " limit_exhausted" )(
7675 " limit" , Context->GetCommonContext ()->GetReadMetadata ()->GetLimitRobust ())(" fetched" , FetchedCount);
7776 SortedSources.clear ();
77+ break ;
7878 }
7979 }
8080 }
@@ -133,6 +133,8 @@ TConclusion<bool> TScanHead::BuildNextInterval() {
133133 for (auto it = FetchingInFlightSources.begin (); it != FetchingInFlightSources.end (); ++it) {
134134 if ((*it)->GetFinish () < SortedSources.front ()->GetStart ()) {
135135 ++inFlightCountLocal;
136+ } else {
137+ break ;
136138 }
137139 }
138140 }
@@ -148,6 +150,8 @@ TConclusion<bool> TScanHead::BuildNextInterval() {
148150 for (auto it = FetchingInFlightSources.begin (); it != FetchingInFlightSources.end (); ++it) {
149151 if ((*it)->GetFinish () < SortedSources.front ()->GetStart ()) {
150152 ++inFlightCountLocalNew;
153+ } else {
154+ break ;
151155 }
152156 }
153157 AFL_VERIFY (inFlightCountLocal <= inFlightCountLocalNew);
0 commit comments