diff options
author | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-09-28 16:32:38 +0300 |
---|---|---|
committer | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-09-28 16:56:53 +0300 |
commit | 1e354259320faa36787f594c9ab79228751c8728 (patch) | |
tree | acc69eb0613b6fa291a59c1bf6f25de87792c306 | |
parent | 37dbec42669631d3c24512f6ee4dd6e29dcf9dc2 (diff) | |
download | ydb-1e354259320faa36787f594c9ab79228751c8728.tar.gz |
KIKIMR-19213: remove useless optimization
3 files changed, 20 insertions, 21 deletions
diff --git a/ydb/core/tx/columnshard/engines/reader/plain_reader/plain_read_data.cpp b/ydb/core/tx/columnshard/engines/reader/plain_reader/plain_read_data.cpp index a5f3ff41468..88f71ad9cb9 100644 --- a/ydb/core/tx/columnshard/engines/reader/plain_reader/plain_read_data.cpp +++ b/ydb/core/tx/columnshard/engines/reader/plain_reader/plain_read_data.cpp @@ -39,7 +39,7 @@ TPlainReadData::TPlainReadData(TReadMetadata::TConstPtr readMetadata, const TRea auto start = GetReadMetadata()->BuildSortedPosition((*itPortion)->IndexKeyStart()); auto finish = GetReadMetadata()->BuildSortedPosition((*itPortion)->IndexKeyEnd()); AFL_DEBUG(NKikimrServices::TX_COLUMNSHARD)("event", "portions_for_merge")("start", start.DebugJson())("finish", finish.DebugJson()); - sources.emplace_back(std::make_shared<TPortionDataSource>(sourceIdx++, (*itPortion), *this, start, finish)); + sources.emplace_back(std::make_shared<TPortionDataSource>(sourceIdx++, *itPortion, *this, start, finish)); ++itPortion; } else { auto start = GetReadMetadata()->BuildSortedPosition(itCommitted->GetFirstVerified()); diff --git a/ydb/core/tx/columnshard/engines/reader/plain_reader/scanner.cpp b/ydb/core/tx/columnshard/engines/reader/plain_reader/scanner.cpp index 307c5ff86a4..91d4574890e 100644 --- a/ydb/core/tx/columnshard/engines/reader/plain_reader/scanner.cpp +++ b/ydb/core/tx/columnshard/engines/reader/plain_reader/scanner.cpp @@ -27,13 +27,14 @@ TScanHead::TScanHead(std::deque<std::shared_ptr<IDataSource>>&& sources, TPlainR bool TScanHead::BuildNextInterval() { while (BorderPoints.size()) { - Y_VERIFY(FrontEnds.size()); +// Y_VERIFY(FrontEnds.size()); auto position = BorderPoints.begin()->first; auto firstBorderPointInfo = std::move(BorderPoints.begin()->second); const bool isIncludeStart = CurrentSegments.empty(); for (auto&& i : firstBorderPointInfo.GetStartSources()) { - CurrentSegments.emplace(i->GetSourceIdx(), i); + AFL_DEBUG(NKikimrServices::TX_COLUMNSHARD)("add_source", i->GetSourceIdx()); + AFL_VERIFY(CurrentSegments.emplace(i->GetSourceIdx(), i).second)("idx", i->GetSourceIdx()); } if (firstBorderPointInfo.GetStartSources().size() && firstBorderPointInfo.GetFinishSources().size()) { @@ -44,20 +45,21 @@ bool TScanHead::BuildNextInterval() { } for (auto&& i : firstBorderPointInfo.GetFinishSources()) { - Y_VERIFY(CurrentSegments.erase(i->GetSourceIdx())); + AFL_DEBUG(NKikimrServices::TX_COLUMNSHARD)("remove_source", i->GetSourceIdx()); + AFL_VERIFY(CurrentSegments.erase(i->GetSourceIdx()))("idx", i->GetSourceIdx()); } - const bool isFirstFinished = (position == *FrontEnds.begin()); - if (firstBorderPointInfo.GetFinishSources().size()) { - Y_VERIFY(isFirstFinished); - Y_VERIFY(FrontEnds.erase(position)); - } else { - Y_VERIFY(!FrontEnds.erase(position)); - } - - if (isFirstFinished) { - DrainSources(); - } +// const bool isFirstFinished = (position == *FrontEnds.begin()); +// if (firstBorderPointInfo.GetFinishSources().size()) { +// Y_VERIFY(isFirstFinished); +// Y_VERIFY(FrontEnds.erase(position)); +// } else { +// Y_VERIFY(!FrontEnds.erase(position)); +// } + +// if (isFirstFinished) { +// DrainSources(); +// } CurrentStart = BorderPoints.begin()->first; BorderPoints.erase(BorderPoints.begin()); if (CurrentSegments.size()) { @@ -85,12 +87,9 @@ void TScanHead::DrainResults() { } void TScanHead::DrainSources() { - if (Sources.empty()) { - return; - } - while (Sources.size() && (FrontEnds.empty() || Sources.front()->GetStart().Compare(*FrontEnds.begin()) != std::partial_ordering::greater)) { + while (Sources.size()/* && (FrontEnds.empty() || Sources.front()->GetStart().Compare(*FrontEnds.begin()) != std::partial_ordering::greater)*/) { auto source = Sources.front(); - FrontEnds.emplace(source->GetFinish()); +// FrontEnds.emplace(source->GetFinish()); BorderPoints[source->GetStart()].AddStart(source); BorderPoints[source->GetFinish()].AddFinish(source); Sources.pop_front(); diff --git a/ydb/core/tx/columnshard/engines/reader/plain_reader/scanner.h b/ydb/core/tx/columnshard/engines/reader/plain_reader/scanner.h index f20df47faac..9c0525252ab 100644 --- a/ydb/core/tx/columnshard/engines/reader/plain_reader/scanner.h +++ b/ydb/core/tx/columnshard/engines/reader/plain_reader/scanner.h @@ -26,7 +26,7 @@ private: std::deque<std::shared_ptr<IDataSource>> Sources; std::vector<std::shared_ptr<arrow::Field>> ResultFields; THashMap<ui32, std::shared_ptr<IDataSource>> SourceByIdx; - std::set<NIndexedReader::TSortableBatchPosition> FrontEnds; +// std::set<NIndexedReader::TSortableBatchPosition> FrontEnds; std::map<NIndexedReader::TSortableBatchPosition, TDataSourceEndpoint> BorderPoints; std::map<ui32, std::shared_ptr<IDataSource>> CurrentSegments; std::optional<NIndexedReader::TSortableBatchPosition> CurrentStart; |