Skip to content

Commit 5424e5a

Browse files
dont move non-actualized buckets in rating scale (#9628)
1 parent bacb7fa commit 5424e5a

File tree

1 file changed

+15
-10
lines changed
  • ydb/core/tx/columnshard/engines/storage/optimizer/lbuckets/planner

1 file changed

+15
-10
lines changed

ydb/core/tx/columnshard/engines/storage/optimizer/lbuckets/planner/optimizer.h

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -939,13 +939,14 @@ class TPortionsBucket: public TMoveOnly {
939939
dest.MoveNextBorderTo(*this);
940940
}
941941

942-
void Actualize(const TInstant currentInstant) {
942+
[[nodiscard]] bool Actualize(const TInstant currentInstant) {
943943
if (currentInstant < NextActualizeInstant) {
944-
return;
944+
return false;
945945
}
946946
auto gChartsThis = StartModificationGuard();
947947
NextActualizeInstant = Others.Actualize(currentInstant);
948948
RebuildOptimizedFeature(currentInstant);
949+
return true;
949950
}
950951

951952
void SplitOthersWith(TPortionsBucket& dest) {
@@ -984,7 +985,11 @@ class TPortionBuckets {
984985
}
985986

986987
void RemoveBucketFromRating(const std::shared_ptr<TPortionsBucket>& bucket) {
987-
auto it = BucketsByWeight.find(bucket->GetLastWeight());
988+
return RemoveBucketFromRating(bucket, bucket->GetLastWeight());
989+
}
990+
991+
void RemoveBucketFromRating(const std::shared_ptr<TPortionsBucket>& bucket, const i64 rating) {
992+
auto it = BucketsByWeight.find(rating);
988993
AFL_VERIFY(it != BucketsByWeight.end());
989994
AFL_VERIFY(it->second.erase(bucket.get()));
990995
if (it->second.empty()) {
@@ -1068,9 +1073,7 @@ class TPortionBuckets {
10681073
if (BucketsByWeight.empty()) {
10691074
return false;
10701075
}
1071-
if (BucketsByWeight.rbegin()->second.empty()) {
1072-
return false;
1073-
}
1076+
AFL_VERIFY(BucketsByWeight.rbegin()->second.size());
10741077
const TPortionsBucket* bucketForOptimization = *BucketsByWeight.rbegin()->second.begin();
10751078
return bucketForOptimization->IsLocked(dataLocksManager);
10761079
}
@@ -1087,12 +1090,14 @@ class TPortionBuckets {
10871090

10881091
void Actualize(const TInstant currentInstant) {
10891092
RemoveBucketFromRating(LeftBucket);
1090-
LeftBucket->Actualize(currentInstant);
1093+
Y_UNUSED(LeftBucket->Actualize(currentInstant));
10911094
AddBucketToRating(LeftBucket);
10921095
for (auto&& i : Buckets) {
1093-
RemoveBucketFromRating(i.second);
1094-
i.second->Actualize(currentInstant);
1095-
AddBucketToRating(i.second);
1096+
const i64 rating = i.second->GetWeight();
1097+
if (i.second->Actualize(currentInstant)) {
1098+
RemoveBucketFromRating(i.second, rating);
1099+
AddBucketToRating(i.second);
1100+
}
10961101
}
10971102
}
10981103

0 commit comments

Comments
 (0)