Skip to content

Commit

Permalink
Merge 6ec71ea into a20c225
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad-gogov authored Sep 4, 2024
2 parents a20c225 + 6ec71ea commit d40d4d2
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 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 @@ -154,4 +154,5 @@ message TFeatureFlags {
optional bool EnableResourcePoolsCounters = 135 [default = false];
optional bool EnableOptionalColumnsInColumnShard = 136 [default = false];
optional bool EnableGranularTimecast = 137 [default = true];
optional bool EnableOlapCompression = 138 [default = false];
}
3 changes: 2 additions & 1 deletion ydb/core/testlib/basics/feature_flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ class TTestFeatureFlagsHolder {
FEATURE_FLAG_SETTER(EnableChangefeedsOnIndexTables)
FEATURE_FLAG_SETTER(EnableBackupService)
FEATURE_FLAG_SETTER(EnableGranularTimecast)
FEATURE_FLAG_SETTER(EnableOlapCompression)

#undef FEATURE_FLAG_SETTER
#undef FEATURE_FLAG_SETTER
};

} // NKikimr
11 changes: 11 additions & 0 deletions ydb/core/tx/schemeshard/olap/operations/alter_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,17 @@ class TAlterOlapStore: public TSubOperation {

auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));

if (HasAppData() && !AppDataVerified().FeatureFlags.GetEnableOlapCompression()) {
for (const auto& alterSchema : alter.GetAlterSchemaPresets()) {
for (const auto& alterColumn : alterSchema.GetAlterSchema().GetAlterColumns()) {
if (alterColumn.HasSerializer()) {
result->SetError(NKikimrScheme::StatusPreconditionFailed, "Compression is disabled for OLAP tables");
return result;
}
}
}
}

if (!alter.HasName()) {
result->SetError(NKikimrScheme::StatusInvalidParameter, "No store name in Alter");
return result;
Expand Down
9 changes: 9 additions & 0 deletions ydb/core/tx/schemeshard/olap/operations/alter_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,15 @@ class TAlterColumnTable: public TSubOperation {

auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));

if (HasAppData() && !AppDataVerified().FeatureFlags.GetEnableOlapCompression()) {
for (const auto& alterColumn : Transaction.GetAlterColumnTable().GetAlterSchema().GetAlterColumns()) {
if (alterColumn.HasSerializer()) {
result->SetError(NKikimrScheme::StatusPreconditionFailed, "Compression is disabled for OLAP tables");
return result;
}
}
}

const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = Transaction.HasAlterColumnTable() ? Transaction.GetAlterColumnTable().GetName() : Transaction.GetAlterTable().GetName();
LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
Expand Down

0 comments on commit d40d4d2

Please sign in to comment.