Skip to content

Commit

Permalink
Disable ALTER OBJECT for column tables by default
Browse files Browse the repository at this point in the history
  • Loading branch information
zverevgeny committed Jan 12, 2025
1 parent af411bb commit 88d4979
Show file tree
Hide file tree
Showing 12 changed files with 86 additions and 22 deletions.
3 changes: 3 additions & 0 deletions ydb/core/kqp/gateway/behaviour/tablestore/manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ NThreading::TFuture<TTableStoreManager::TYqlConclusionStatus> TTableStoreManager
return NThreading::MakeFuture<TYqlConclusionStatus>(TYqlConclusionStatus::Fail("not implemented"));
case EActivityType::Alter:
try {
if (!AppData()->ColumnShardConfig.GetAlterObjectEnabled()) {
return NThreading::MakeFuture<TYqlConclusionStatus>(TYqlConclusionStatus::Fail("ALTER OBJECT is disabled for column tables"));
}
auto actionName = settings.GetFeaturesExtractor().Extract("ACTION");
if (!actionName) {
return NThreading::MakeFuture<TYqlConclusionStatus>(TYqlConclusionStatus::Fail("can't find ACTION parameter"));
Expand Down
4 changes: 3 additions & 1 deletion ydb/core/kqp/ut/olap/aggregations_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ namespace NKikimr::NKqp {

Y_UNIT_TEST_SUITE(KqpOlapAggregations) {
Y_UNIT_TEST(Aggregation) {
auto settings = TKikimrSettings()
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings().SetAppConfig(appConfig)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);

Expand Down
7 changes: 4 additions & 3 deletions ydb/core/kqp/ut/olap/blobs_sharing_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ Y_UNIT_TEST_SUITE(KqpOlapBlobsSharing) {
};

TKikimrSettings GetKikimrSettings() {
NKikimrConfig::TFeatureFlags featureFlags;
featureFlags.SetEnableAlterShardingInColumnShard(true);
return TKikimrSettings().SetWithSampleTables(false).SetFeatureFlags(featureFlags);
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
appConfig.MutableFeatureFlags()->SetEnableAlterShardingInColumnShard(true);
return TKikimrSettings().SetWithSampleTables(false).SetAppConfig(appConfig);
}

class TSharingDataTestCase {
Expand Down
19 changes: 15 additions & 4 deletions ydb/core/kqp/ut/olap/indexes_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ namespace NKikimr::NKqp {

Y_UNIT_TEST_SUITE(KqpOlapIndexes) {
Y_UNIT_TEST(IndexesActualization) {
auto settings = TKikimrSettings().SetWithSampleTables(false);
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings().SetAppConfig(appConfig).SetWithSampleTables(false);
TKikimrRunner kikimr(settings);

auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NYDBTest::NColumnShard::TController>();
Expand Down Expand Up @@ -96,7 +98,9 @@ Y_UNIT_TEST_SUITE(KqpOlapIndexes) {
}

Y_UNIT_TEST(CountMinSketchIndex) {
auto settings = TKikimrSettings().SetWithSampleTables(false);
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings().SetAppConfig(appConfig).SetWithSampleTables(false);
TKikimrRunner kikimr(settings);

auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NYDBTest::NColumnShard::TController>();
Expand Down Expand Up @@ -239,7 +243,11 @@ Y_UNIT_TEST_SUITE(KqpOlapIndexes) {
}

Y_UNIT_TEST(SchemeActualizationOnceOnStart) {
auto settings = TKikimrSettings().SetWithSampleTables(false);
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings()
.SetAppConfig(appConfig)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);

auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NYDBTest::NColumnShard::TController>();
Expand Down Expand Up @@ -340,6 +348,7 @@ Y_UNIT_TEST_SUITE(KqpOlapIndexes) {
TTestIndexesScenario& Initialize() {
Settings = TKikimrSettings().SetWithSampleTables(false);
Settings.AppConfig.MutableColumnShardConfig()->SetReaderClassName("SIMPLE");
Settings.AppConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
Kikimr = std::make_unique<TKikimrRunner>(Settings);
return *this;
}
Expand Down Expand Up @@ -552,7 +561,9 @@ Y_UNIT_TEST_SUITE(KqpOlapIndexes) {
}

Y_UNIT_TEST(IndexesModificationError) {
auto settings = TKikimrSettings().SetWithSampleTables(false);
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings().SetAppConfig(appConfig).SetWithSampleTables(false);
TKikimrRunner kikimr(settings);

TLocalHelper(kikimr).CreateTestOlapTable();
Expand Down
12 changes: 9 additions & 3 deletions ydb/core/kqp/ut/olap/kqp_olap_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2640,7 +2640,9 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
}

Y_UNIT_TEST(CompactionPlanner) {
auto settings = TKikimrSettings().SetWithSampleTables(false);
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings().SetAppConfig(appConfig).SetWithSampleTables(false);
TKikimrRunner kikimr(settings);

TLocalHelper(kikimr).CreateTestOlapTable();
Expand Down Expand Up @@ -2724,7 +2726,9 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
}

Y_UNIT_TEST(MetadataMemoryManager) {
auto settings = TKikimrSettings().SetWithSampleTables(false);
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings().SetAppConfig(appConfig).SetWithSampleTables(false);
TKikimrRunner kikimr(settings);

TLocalHelper(kikimr).CreateTestOlapTable();
Expand Down Expand Up @@ -2781,7 +2785,9 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
}

Y_UNIT_TEST(NormalizeAbsentColumn) {
auto settings = TKikimrSettings().SetWithSampleTables(false);
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings().SetAppConfig(appConfig).SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
TLocalHelper testHelper(kikimr);

Expand Down
14 changes: 12 additions & 2 deletions ydb/core/kqp/ut/olap/sparsed_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ Y_UNIT_TEST_SUITE(KqpOlapSparsed) {

class TSparsedDataTest {
private:
const TKikimrSettings Settings = TKikimrSettings().SetWithSampleTables(false);
static NKikimrConfig::TAppConfig GetAppConfig() {
NKikimrConfig::TAppConfig config;
config.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
return config;
}

const TKikimrSettings Settings = TKikimrSettings()
.SetAppConfig(GetAppConfig())
.SetWithSampleTables(false);
TKikimrRunner Kikimr;
NKikimr::NYDBTest::TControllers::TGuard<NKikimr::NYDBTest::NColumnShard::TController> CSController;
const TString StoreName;
Expand Down Expand Up @@ -304,7 +312,9 @@ Y_UNIT_TEST_SUITE(KqpOlapSparsed) {
}

Y_UNIT_TEST(AccessorActualization) {
auto settings = TKikimrSettings().SetWithSampleTables(false);
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings().SetAppConfig(appConfig).SetWithSampleTables(false);
TKikimrRunner kikimr(settings);

auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NYDBTest::NColumnShard::TController>();
Expand Down
12 changes: 9 additions & 3 deletions ydb/core/kqp/ut/olap/statistics_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ Y_UNIT_TEST_SUITE(KqpOlapStatistics) {
Y_UNIT_TEST(StatsUsage) {
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NYDBTest::NColumnShard::TController>();
{
auto settings = TKikimrSettings().SetWithSampleTables(false);
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings().SetAppConfig(appConfig).SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
TTypedLocalHelper helper("Utf8", kikimr);
Expand Down Expand Up @@ -49,7 +51,9 @@ Y_UNIT_TEST_SUITE(KqpOlapStatistics) {
Y_UNIT_TEST(StatsUsageNotPK) {
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NYDBTest::NColumnShard::TController>();
{
auto settings = TKikimrSettings().SetWithSampleTables(false);
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings().SetAppConfig(appConfig).SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
TTypedLocalHelper helper("Utf8", kikimr);
Expand Down Expand Up @@ -87,7 +91,9 @@ Y_UNIT_TEST_SUITE(KqpOlapStatistics) {
Y_UNIT_TEST(StatsUsageWithTTL) {
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NYDBTest::NColumnShard::TController>();
{
auto settings = TKikimrSettings().SetWithSampleTables(false);
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings().SetAppConfig(appConfig).SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
TTypedLocalHelper helper("Utf8", kikimr);
Expand Down
22 changes: 20 additions & 2 deletions ydb/core/kqp/ut/olap/sys_view_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
{
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NOlap::TWaitCompactionController>();
csController->SetOverrideBlobSplitSettings(NOlap::NSplitter::TSplitSettings());
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings()
.SetAppConfig(appConfig)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
Expand All @@ -136,7 +139,10 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
const ui32 rowsCount = 800000;
const ui32 groupsCount = 512;
{
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings()
.SetAppConfig(appConfig)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
Expand Down Expand Up @@ -191,7 +197,10 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
ui64 rawBytesPK1;
ui64 bytesPK1;
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NOlap::TWaitCompactionController>();
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings()
.SetAppConfig(appConfig)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
Expand Down Expand Up @@ -228,7 +237,9 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
ui64 rawBytes1;
ui64 bytes1;
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NOlap::TWaitCompactionController>();
auto settings = TKikimrSettings().SetWithSampleTables(false);
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings().SetAppConfig(appConfig).SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
TTypedLocalHelper helper("Utf8", kikimr);
Expand Down Expand Up @@ -259,7 +270,10 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
ui64 rawBytes1;
ui64 bytes1;
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NOlap::TWaitCompactionController>();
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings()
.SetAppConfig(appConfig)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
Expand Down Expand Up @@ -298,7 +312,11 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
ui64 bytes1;
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NOlap::TWaitCompactionController>();
csController->SetSmallSizeDetector(Max<ui32>());
auto settings = TKikimrSettings().SetWithSampleTables(false);
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings()
.SetAppConfig(appConfig)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
TTypedLocalHelper helper("Utf8", kikimr);
Expand Down
7 changes: 4 additions & 3 deletions ydb/core/kqp/ut/olap/tiering_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ class TTestEvictionBase {
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NOlap::TWaitCompactionController>();
csController->SetSkipSpecialCheckForEvict(true);

TKikimrSettings runnerSettings;
runnerSettings.WithSampleTables = false;
TestHelper.emplace(runnerSettings);
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings().SetAppConfig(appConfig).SetWithSampleTables(false);
TestHelper.emplace(settings);
TLocalHelper localHelper(TestHelper->GetKikimr());
// TestHelper->GetRuntime().SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_DEBUG);
// TestHelper->GetRuntime().SetLogPriority(NKikimrServices::TX_COLUMNSHARD, NActors::NLog::PRI_DEBUG);
Expand Down
4 changes: 3 additions & 1 deletion ydb/core/kqp/ut/olap/write_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ Y_UNIT_TEST_SUITE(KqpOlapWrite) {
}

Y_UNIT_TEST(DefaultValues) {
auto settings = TKikimrSettings().SetWithSampleTables(false);
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);
auto settings = TKikimrSettings().SetAppConfig(appConfig).SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
TTypedLocalHelper helper("Utf8", kikimr);
Expand Down
3 changes: 3 additions & 0 deletions ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8503,6 +8503,9 @@ Y_UNIT_TEST_SUITE(KqpOlapScheme) {
}

Y_UNIT_TEST(AddColumnWithTtl) {
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(true);

TKikimrSettings runnerSettings;
runnerSettings.WithSampleTables = false;
TTestHelper testHelper(runnerSettings);
Expand Down
1 change: 1 addition & 0 deletions ydb/core/protos/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1792,6 +1792,7 @@ message TColumnShardConfig {
optional uint64 WritingBufferVolumeMb = 33 [default = 32];
optional uint64 WritingInFlightRequestsCountLimit = 34 [default = 1000];
optional uint64 WritingInFlightRequestBytesLimit = 35 [default = 128000000];
optional bool AlterObjectEnabled = 36 [default = false];
}

message TSchemeShardConfig {
Expand Down

0 comments on commit 88d4979

Please sign in to comment.