@@ -939,13 +939,14 @@ class TPortionsBucket: public TMoveOnly {
939
939
dest.MoveNextBorderTo (*this );
940
940
}
941
941
942
- void Actualize (const TInstant currentInstant) {
942
+ [[nodiscard]] bool Actualize (const TInstant currentInstant) {
943
943
if (currentInstant < NextActualizeInstant) {
944
- return ;
944
+ return false ;
945
945
}
946
946
auto gChartsThis = StartModificationGuard ();
947
947
NextActualizeInstant = Others.Actualize (currentInstant);
948
948
RebuildOptimizedFeature (currentInstant);
949
+ return true ;
949
950
}
950
951
951
952
void SplitOthersWith (TPortionsBucket& dest) {
@@ -984,7 +985,11 @@ class TPortionBuckets {
984
985
}
985
986
986
987
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);
988
993
AFL_VERIFY (it != BucketsByWeight.end ());
989
994
AFL_VERIFY (it->second .erase (bucket.get ()));
990
995
if (it->second .empty ()) {
@@ -1068,9 +1073,7 @@ class TPortionBuckets {
1068
1073
if (BucketsByWeight.empty ()) {
1069
1074
return false ;
1070
1075
}
1071
- if (BucketsByWeight.rbegin ()->second .empty ()) {
1072
- return false ;
1073
- }
1076
+ AFL_VERIFY (BucketsByWeight.rbegin ()->second .size ());
1074
1077
const TPortionsBucket* bucketForOptimization = *BucketsByWeight.rbegin ()->second .begin ();
1075
1078
return bucketForOptimization->IsLocked (dataLocksManager);
1076
1079
}
@@ -1087,12 +1090,14 @@ class TPortionBuckets {
1087
1090
1088
1091
void Actualize (const TInstant currentInstant) {
1089
1092
RemoveBucketFromRating (LeftBucket);
1090
- LeftBucket->Actualize (currentInstant);
1093
+ Y_UNUSED ( LeftBucket->Actualize (currentInstant) );
1091
1094
AddBucketToRating (LeftBucket);
1092
1095
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
+ }
1096
1101
}
1097
1102
}
1098
1103
0 commit comments