diff options
author | ivanmorozov333 <ivanmorozov@ydb.tech> | 2024-09-23 17:38:30 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-23 17:38:30 +0300 |
commit | 5424e5a4f24f81a814ceb7b4440a43e58ff81714 (patch) | |
tree | 59d23f298606464b3b20936622fbaa8822e1d2d4 | |
parent | bacb7fa9f3f2701b35003e858dbdb075ddec91fd (diff) | |
download | ydb-5424e5a4f24f81a814ceb7b4440a43e58ff81714.tar.gz |
dont move non-actualized buckets in rating scale (#9628)
-rw-r--r-- | ydb/core/tx/columnshard/engines/storage/optimizer/lbuckets/planner/optimizer.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/ydb/core/tx/columnshard/engines/storage/optimizer/lbuckets/planner/optimizer.h b/ydb/core/tx/columnshard/engines/storage/optimizer/lbuckets/planner/optimizer.h index d686fc71911..7293e4cb1e4 100644 --- a/ydb/core/tx/columnshard/engines/storage/optimizer/lbuckets/planner/optimizer.h +++ b/ydb/core/tx/columnshard/engines/storage/optimizer/lbuckets/planner/optimizer.h @@ -939,13 +939,14 @@ public: dest.MoveNextBorderTo(*this); } - void Actualize(const TInstant currentInstant) { + [[nodiscard]] bool Actualize(const TInstant currentInstant) { if (currentInstant < NextActualizeInstant) { - return; + return false; } auto gChartsThis = StartModificationGuard(); NextActualizeInstant = Others.Actualize(currentInstant); RebuildOptimizedFeature(currentInstant); + return true; } void SplitOthersWith(TPortionsBucket& dest) { @@ -984,7 +985,11 @@ private: } void RemoveBucketFromRating(const std::shared_ptr<TPortionsBucket>& bucket) { - auto it = BucketsByWeight.find(bucket->GetLastWeight()); + return RemoveBucketFromRating(bucket, bucket->GetLastWeight()); + } + + void RemoveBucketFromRating(const std::shared_ptr<TPortionsBucket>& bucket, const i64 rating) { + auto it = BucketsByWeight.find(rating); AFL_VERIFY(it != BucketsByWeight.end()); AFL_VERIFY(it->second.erase(bucket.get())); if (it->second.empty()) { @@ -1068,9 +1073,7 @@ public: if (BucketsByWeight.empty()) { return false; } - if (BucketsByWeight.rbegin()->second.empty()) { - return false; - } + AFL_VERIFY(BucketsByWeight.rbegin()->second.size()); const TPortionsBucket* bucketForOptimization = *BucketsByWeight.rbegin()->second.begin(); return bucketForOptimization->IsLocked(dataLocksManager); } @@ -1087,12 +1090,14 @@ public: void Actualize(const TInstant currentInstant) { RemoveBucketFromRating(LeftBucket); - LeftBucket->Actualize(currentInstant); + Y_UNUSED(LeftBucket->Actualize(currentInstant)); AddBucketToRating(LeftBucket); for (auto&& i : Buckets) { - RemoveBucketFromRating(i.second); - i.second->Actualize(currentInstant); - AddBucketToRating(i.second); + const i64 rating = i.second->GetWeight(); + if (i.second->Actualize(currentInstant)) { + RemoveBucketFromRating(i.second, rating); + AddBucketToRating(i.second); + } } } |