Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable ALTER OBJECT for column tables by default #13299

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: 4 additions & 0 deletions ydb/core/kqp/ut/common/kqp_ut_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ struct TKikimrSettings: public TTestFeatureFlagsHolder<TKikimrSettings> {
TKikimrSettings& SetUseRealThreads(bool value) { UseRealThreads = value; return *this; };
TKikimrSettings& SetEnableForceFollowers(bool value) { EnableForceFollowers = value; return *this; };
TKikimrSettings& SetS3ActorsFactory(std::shared_ptr<NYql::NDq::IS3ActorsFactory> value) { S3ActorsFactory = std::move(value); return *this; };
TKikimrSettings& SetColumnShardAlterObjectEnabled(bool enable) {
AppConfig.MutableColumnShardConfig()->SetAlterObjectEnabled(enable);
return *this;
}
};

class TKikimrRunner {
Expand Down
1 change: 1 addition & 0 deletions ydb/core/kqp/ut/olap/aggregations_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace NKikimr::NKqp {
Y_UNIT_TEST_SUITE(KqpOlapAggregations) {
Y_UNIT_TEST(Aggregation) {
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);

Expand Down
5 changes: 4 additions & 1 deletion ydb/core/kqp/ut/olap/blobs_sharing_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ Y_UNIT_TEST_SUITE(KqpOlapBlobsSharing) {
TKikimrSettings GetKikimrSettings() {
NKikimrConfig::TFeatureFlags featureFlags;
featureFlags.SetEnableAlterShardingInColumnShard(true);
return TKikimrSettings().SetWithSampleTables(false).SetFeatureFlags(featureFlags);
return TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false)
.SetFeatureFlags(featureFlags);
}

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

Y_UNIT_TEST_SUITE(KqpOlapCompression) {
Y_UNIT_TEST(DisabledAlterCompression) {
TKikimrSettings settings = TKikimrSettings().SetWithSampleTables(false).SetEnableOlapCompression(false);
auto settings = TKikimrSettings()
.SetEnableOlapCompression(false)
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false);
TTestHelper testHelper(settings);
TVector<TTestHelper::TColumnSchema> schema = {
TTestHelper::TColumnSchema().SetName("pk_int").SetType(NScheme::NTypeIds::Uint64).SetNullable(false)
Expand All @@ -28,7 +31,9 @@ Y_UNIT_TEST_SUITE(KqpOlapCompression) {
}

Y_UNIT_TEST(OffCompression) {
TKikimrSettings settings = TKikimrSettings().SetWithSampleTables(false);
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false);
TTestHelper testHelper(settings);
TVector<TTestHelper::TColumnSchema> schema = {
TTestHelper::TColumnSchema().SetName("pk_int").SetType(NScheme::NTypeIds::Uint64).SetNullable(false)
Expand All @@ -47,7 +52,9 @@ Y_UNIT_TEST_SUITE(KqpOlapCompression) {
}

Y_UNIT_TEST(TestAlterCompressionTableInTableStore) {
TKikimrSettings settings = TKikimrSettings().SetWithSampleTables(false);
TKikimrSettings settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false);
TTestHelper testHelper(settings);
TVector<TTestHelper::TColumnSchema> schema = {
TTestHelper::TColumnSchema().SetName("pk_int").SetType(NScheme::NTypeIds::Uint64).SetNullable(false)
Expand Down
20 changes: 15 additions & 5 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);
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.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);
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);

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

Y_UNIT_TEST(SchemeActualizationOnceOnStart) {
auto settings = TKikimrSettings().SetWithSampleTables(false);
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);

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

public:
TTestIndexesScenario& Initialize() {
Settings = TKikimrSettings().SetWithSampleTables(false);
Settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false);
Settings.AppConfig.MutableColumnShardConfig()->SetReaderClassName("SIMPLE");
Kikimr = std::make_unique<TKikimrRunner>(Settings);
return *this;
Expand Down Expand Up @@ -552,7 +560,9 @@ Y_UNIT_TEST_SUITE(KqpOlapIndexes) {
}

Y_UNIT_TEST(IndexesModificationError) {
auto settings = TKikimrSettings().SetWithSampleTables(false);
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);

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

Y_UNIT_TEST(AlterObjectDisabled) {
auto settings = TKikimrSettings()
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
TLocalHelper(kikimr).CreateTestOlapTableWithoutStore();

auto tableClient = kikimr.GetTableClient();
auto session = tableClient.CreateSession().GetValueSync().GetSession();
auto alterResult = session.ExecuteSchemeQuery(
"ALTER OBJECT `/Root/olapTable` (TYPE TABLE) SET (ACTION=ALTER_COLUMN, NAME=message, `SERIALIZER.CLASS_NAME`=`ARROW_SERIALIZER`, `COMPRESSION.TYPE`=`zstd`, `COMPRESSION.LEVEL`=`4`)"
).GetValueSync();
UNIT_ASSERT_VALUES_EQUAL(alterResult.GetStatus(), NYdb::EStatus::GENERIC_ERROR);
UNIT_ASSERT_STRING_CONTAINS_C(alterResult.GetIssues().ToString(), "Error: ALTER OBJECT is disabled for column tables", alterResult.GetIssues().ToString());

}

Y_UNIT_TEST(SimpleQueryOlap) {
auto settings = TKikimrSettings()
.SetWithSampleTables(false);
Expand Down Expand Up @@ -2640,7 +2656,9 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
}

Y_UNIT_TEST(CompactionPlanner) {
auto settings = TKikimrSettings().SetWithSampleTables(false);
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);

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

Y_UNIT_TEST(MetadataMemoryManager) {
auto settings = TKikimrSettings().SetWithSampleTables(false);
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);

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

Y_UNIT_TEST(NormalizeAbsentColumn) {
auto settings = TKikimrSettings().SetWithSampleTables(false);
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
TLocalHelper testHelper(kikimr);

Expand Down
8 changes: 6 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,9 @@ Y_UNIT_TEST_SUITE(KqpOlapSparsed) {

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

Y_UNIT_TEST(AccessorActualization) {
auto settings = TKikimrSettings().SetWithSampleTables(false);
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.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);
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.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);
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.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);
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
TTypedLocalHelper helper("Utf8", kikimr);
Expand Down
12 changes: 10 additions & 2 deletions ydb/core/kqp/ut/olap/sys_view_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NOlap::TWaitCompactionController>();
csController->SetOverrideBlobSplitSettings(NOlap::NSplitter::TSplitSettings());
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
Expand All @@ -137,6 +138,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
const ui32 groupsCount = 512;
{
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
Expand Down Expand Up @@ -192,6 +194,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
ui64 bytesPK1;
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NOlap::TWaitCompactionController>();
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
Expand Down Expand Up @@ -228,7 +231,9 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
ui64 rawBytes1;
ui64 bytes1;
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NOlap::TWaitCompactionController>();
auto settings = TKikimrSettings().SetWithSampleTables(false);
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
TTypedLocalHelper helper("Utf8", kikimr);
Expand Down Expand Up @@ -260,6 +265,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
ui64 bytes1;
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NOlap::TWaitCompactionController>();
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
Expand Down Expand Up @@ -298,7 +304,9 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
ui64 bytes1;
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NOlap::TWaitCompactionController>();
csController->SetSmallSizeDetector(Max<ui32>());
auto settings = TKikimrSettings().SetWithSampleTables(false);
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
TTypedLocalHelper helper("Utf8", kikimr);
Expand Down
8 changes: 4 additions & 4 deletions ydb/core/kqp/ut/olap/tiering_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ class TTestEvictionBase {
void RunTest() {
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NOlap::TWaitCompactionController>();
csController->SetSkipSpecialCheckForEvict(true);

TKikimrSettings runnerSettings;
runnerSettings.WithSampleTables = false;
TestHelper.emplace(runnerSettings);
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.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);
auto settings = TKikimrSettings()
.SetColumnShardAlterObjectEnabled(true)
.SetWithSampleTables(false);
TKikimrRunner kikimr(settings);
Tests::NCommon::TLoggerInit(kikimr).Initialize();
TTypedLocalHelper helper("Utf8", kikimr);
Expand Down
Loading
Loading