Skip to content

Commit

Permalink
Merge 6d21224 into cea9d83
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad-gogov authored Sep 6, 2024
2 parents cea9d83 + 6d21224 commit 553b4a7
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ydb/core/kqp/ut/olap/sys_view_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
const ui32 rowsCount = 800000;
const ui32 groupsCount = 512;
{
auto settings = TKikimrSettings()
.SetWithSampleTables(false);
NKikimrConfig::TFeatureFlags featureFlags;
featureFlags.SetEnableOlapCompression(true);
auto settings = TKikimrSettings().SetWithSampleTables(false).SetFeatureFlags(featureFlags);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
TTypedLocalHelper helper("Utf8", kikimr);
Expand Down Expand Up @@ -186,8 +187,9 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
ui64 rawBytesPK1;
ui64 bytesPK1;
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NOlap::TWaitCompactionController>();
auto settings = TKikimrSettings()
.SetWithSampleTables(false);
NKikimrConfig::TFeatureFlags featureFlags;
featureFlags.SetEnableOlapCompression(true);
auto settings = TKikimrSettings().SetWithSampleTables(false).SetFeatureFlags(featureFlags);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
TTypedLocalHelper helper("", kikimr, "olapTable", "olapStore");
Expand Down
1 change: 1 addition & 0 deletions ydb/core/protos/feature_flags.proto
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,5 @@ message TFeatureFlags {
optional bool EnableAlterShardingInColumnShard = 138 [default = false];
optional bool EnablePgSyntax = 139 [default = true];
optional bool EnableTieringInColumnShard = 140 [default = false];
optional bool EnableOlapCompression = 141 [default = false];
}
1 change: 1 addition & 0 deletions ydb/core/testlib/basics/feature_flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class TTestFeatureFlagsHolder {
FEATURE_FLAG_SETTER(EnableGranularTimecast)
FEATURE_FLAG_SETTER(EnablePgSyntax)
FEATURE_FLAG_SETTER(EnableTieringInColumnShard)
FEATURE_FLAG_SETTER(EnableOlapCompression)

#undef FEATURE_FLAG_SETTER
};
Expand Down
17 changes: 17 additions & 0 deletions ydb/core/tx/schemeshard/olap/operations/alter_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,18 @@ class TAlterOlapStore: public TSubOperation {
}
}

bool isAlterCompression() const {
const auto& alter = Transaction.GetAlterColumnStore();
for (const auto& alterSchema : alter.GetAlterSchemaPresets()) {
for (const auto& alterColumn : alterSchema.GetAlterSchema().GetAlterColumns()) {
if (alterColumn.HasSerializer()) {
return true;
}
}
}
return false;
}

public:
using TSubOperation::TSubOperation;

Expand All @@ -458,6 +470,11 @@ class TAlterOlapStore: public TSubOperation {
return result;
}

if (!AppDataVerified().FeatureFlags.GetEnableOlapCompression() && isAlterCompression()) {
result->SetError(NKikimrScheme::StatusPreconditionFailed, "Compression is disabled for OLAP tables");
return result;
}

TPath path = TPath::Resolve(parentPathStr, context.SS).Dive(name);
{
TPath::TChecker checks = path.Check();
Expand Down
14 changes: 14 additions & 0 deletions ydb/core/tx/schemeshard/olap/operations/alter_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,15 @@ class TAlterColumnTable: public TSubOperation {
}
}

bool isAlterCompression() const {
for (const auto& alterColumn : Transaction.GetAlterColumnTable().GetAlterSchema().GetAlterColumns()) {
if (alterColumn.HasSerializer()) {
return true;
}
}
return false;
}

public:
using TSubOperation::TSubOperation;

Expand All @@ -270,6 +279,11 @@ class TAlterColumnTable: public TSubOperation {
result->SetError(NKikimrScheme::StatusPreconditionFailed, "Alter sharding is disabled for OLAP tables");
return result;
}

if (!AppDataVerified().FeatureFlags.GetEnableOlapCompression() && isAlterCompression()) {
result->SetError(NKikimrScheme::StatusPreconditionFailed, "Compression is disabled for OLAP tables");
return result;
}

const bool hasTiering = Transaction.HasAlterColumnTable() && Transaction.GetAlterColumnTable().HasAlterTtlSettings() &&
Transaction.GetAlterColumnTable().GetAlterTtlSettings().HasUseTiering();
Expand Down

0 comments on commit 553b4a7

Please sign in to comment.