aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornsofya <nsofya@ydb.tech>2023-11-21 11:44:33 +0300
committernsofya <nsofya@ydb.tech>2023-11-21 13:38:42 +0300
commit1b10ae05649cf79a4ea16d529edbaa395ccbc619 (patch)
tree5002d4772c75f7ccab30eaf108dbb2a8a6307850
parent969a0402c137d51ead6ca9351ad0f5c6452018dd (diff)
downloadydb-1b10ae05649cf79a4ea16d529edbaa395ccbc619.tar.gz
KIKIMR-20104: Skip old granules on compaction
-rw-r--r--ydb/core/protos/config.proto1
-rw-r--r--ydb/core/tx/columnshard/engines/storage/optimizer/abstract/optimizer.h9
2 files changed, 10 insertions, 0 deletions
diff --git a/ydb/core/protos/config.proto b/ydb/core/protos/config.proto
index 4b70952175..dd7113d367 100644
--- a/ydb/core/protos/config.proto
+++ b/ydb/core/protos/config.proto
@@ -1422,6 +1422,7 @@ message TColumnShardConfig {
}
optional TTablesStorageLayoutPolicy TablesStorageLayoutPolicy = 1;
optional bool DisabledOnSchemeShard = 2 [default = true];
+ optional bool SkipOldGranules = 3 [default = true];
}
message TSchemeShardConfig {
diff --git a/ydb/core/tx/columnshard/engines/storage/optimizer/abstract/optimizer.h b/ydb/core/tx/columnshard/engines/storage/optimizer/abstract/optimizer.h
index db9926f451..a55c2118dd 100644
--- a/ydb/core/tx/columnshard/engines/storage/optimizer/abstract/optimizer.h
+++ b/ydb/core/tx/columnshard/engines/storage/optimizer/abstract/optimizer.h
@@ -2,6 +2,7 @@
#include <ydb/core/tx/columnshard/engines/portions/portion_info.h>
#include <ydb/core/formats/arrow/reader/read_filter_merger.h>
#include <library/cpp/object_factory/object_factory.h>
+#include <ydb/core/base/appdata.h>
namespace NKikimr::NOlap {
struct TCompactionLimits;
@@ -79,11 +80,19 @@ public:
std::vector<std::shared_ptr<TPortionInfo>> RemovePortions;
public:
TModificationGuard& AddPortion(const std::shared_ptr<TPortionInfo>& portion) {
+ if (AppData()->ColumnShardConfig.GetSkipOldGranules() && portion->GetDeprecatedGranuleId() > 0) {
+ AFL_WARN(NKikimrServices::TX_COLUMNSHARD)("event", "skip_granule")("granule_id", portion->GetDeprecatedGranuleId());
+ return *this;
+ }
AddPortions.emplace_back(portion);
return*this;
}
TModificationGuard& RemovePortion(const std::shared_ptr<TPortionInfo>& portion) {
+ if (AppData()->ColumnShardConfig.GetSkipOldGranules() && portion->GetDeprecatedGranuleId() > 0) {
+ AFL_WARN(NKikimrServices::TX_COLUMNSHARD)("event", "skip_granule")("granule_id", portion->GetDeprecatedGranuleId());
+ return *this;
+ }
RemovePortions.emplace_back(portion);
return*this;
}