Browse Source

add limits for simultaneous compaction (#1096)

* add limits for simultaneous compaction

* fix build
ivanmorozov333 1 year ago
parent
commit
d160c50c8f

+ 1 - 0
ydb/core/protos/config.proto

@@ -1433,6 +1433,7 @@ message TColumnShardConfig {
     optional bool WritingEnabled = 7 [default = true];
     optional uint32 WritingBufferDurationMs = 8 [default = 0];
     optional bool UseChunkedMergeOnCompaction = 9 [default = true];
+    optional uint64 CompactionMemoryLimit = 10 [default = 536870912];
 }
 
 message TSchemeShardConfig {

+ 2 - 1
ydb/core/tx/columnshard/engines/storage/optimizer/lbuckets/optimizer.h

@@ -713,7 +713,8 @@ public:
         }
         std::optional<NArrow::TReplaceKey> stopPoint;
         std::optional<TInstant> stopInstant;
-        std::vector<std::shared_ptr<TPortionInfo>> portions = Others.GetOptimizerTaskPortions(512 * 1024 * 1024, stopPoint);
+        const ui64 memLimit = HasAppData() ? AppDataVerified().ColumnShardConfig.GetCompactionMemoryLimit() : 512 * 1024 * 1024;
+        std::vector<std::shared_ptr<TPortionInfo>> portions = Others.GetOptimizerTaskPortions(memLimit, stopPoint);
         if (nextBorder) {
             if (MainPortion) {
                 portions.emplace_back(MainPortion);