Skip to content

Commit

Permalink
Merge ae29266 into 26c9911
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad-gogov authored Sep 10, 2024
2 parents 26c9911 + ae29266 commit a334188
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions ydb/core/kqp/ut/common/kqp_ut_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ TKikimrRunner::TKikimrRunner(const TKikimrSettings& settings) {
ServerSettings->SetUseRealThreads(settings.UseRealThreads);
ServerSettings->SetEnableTablePgTypes(true);
ServerSettings->SetEnablePgSyntax(true);
ServerSettings->SetEnableOlapCompression(true);
ServerSettings->S3ActorsFactory = settings.S3ActorsFactory;

if (settings.Storage) {
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 @@ -158,4 +158,5 @@ message TFeatureFlags {
optional bool EnablePgSyntax = 139 [default = true];
optional bool EnableTieringInColumnShard = 140 [default = false];
optional bool EnableMetadataObjectsOnServerless = 141 [default = true];
optional bool EnableOlapCompression = 142 [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 @@ -67,6 +67,7 @@ class TTestFeatureFlagsHolder {
FEATURE_FLAG_SETTER(EnablePgSyntax)
FEATURE_FLAG_SETTER(EnableTieringInColumnShard)
FEATURE_FLAG_SETTER(EnableMetadataObjectsOnServerless)
FEATURE_FLAG_SETTER(EnableOlapCompression)

#undef FEATURE_FLAG_SETTER
};
Expand Down
13 changes: 13 additions & 0 deletions ydb/core/tx/schemeshard/olap/operations/alter/abstract/update.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ namespace NKikimr::NSchemeShard::NOlap::NAlter {
class ISSEntityUpdate {
private:
bool Initialized = false;

bool isAlterCompression(const TUpdateInitializationContext& context) const {
for (const auto& alterColumn : context.GetModification()->GetAlterColumnTable().GetAlterSchema().GetAlterColumns()) {
if (alterColumn.HasSerializer()) {
return true;
}
}
return false;
}

protected:
virtual TConclusionStatus DoInitialize(const TUpdateInitializationContext& context) = 0;
virtual TConclusionStatus DoStart(const TUpdateStartContext& context) = 0;
Expand Down Expand Up @@ -44,6 +54,9 @@ class ISSEntityUpdate {

TConclusionStatus Initialize(const TUpdateInitializationContext& context) {
AFL_VERIFY(!Initialized);
if (!AppData()->FeatureFlags.GetEnableOlapCompression() && isAlterCompression(context)) {
return TConclusionStatus::Fail("Compression is disabled for OLAP tables");
}
auto result = DoInitialize(context);
if (result.IsSuccess()) {
Initialized = true;
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 @@ -436,6 +436,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 @@ -460,6 +472,11 @@ class TAlterOlapStore: public TSubOperation {
return result;
}

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

TPath parentPath = TPath::Resolve(parentPathStr, context.SS);
TPath path = parentPath.Dive(name);
{
Expand Down

0 comments on commit a334188

Please sign in to comment.