diff options
author | chertus <azuikov@ydb.tech> | 2022-10-12 18:05:40 +0300 |
---|---|---|
committer | chertus <azuikov@ydb.tech> | 2022-10-12 18:05:40 +0300 |
commit | 46c1dd8bb937c8d5c4eacd6b836beb567dccae19 (patch) | |
tree | e80d44c2c71428b52a71b86596b0467368f516cb | |
parent | a8796b94ed4bd561bf1f8ac72c423d0d791aea93 (diff) | |
download | ydb-46c1dd8bb937c8d5c4eacd6b836beb567dccae19.tar.gz |
deny CREATE OLAP store with zero shards
-rw-r--r-- | ydb/core/tx/schemeshard/schemeshard__operation_create_olap_store.cpp | 6 | ||||
-rw-r--r-- | ydb/services/ydb/ydb_logstore_ut.cpp | 10 |
2 files changed, 16 insertions, 0 deletions
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_store.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_store.cpp index a8b814ee5d4..cd8469a69d3 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_store.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_store.cpp @@ -183,6 +183,12 @@ TOlapStoreInfo::TPtr CreateOlapStore(const NKikimrSchemeOp::TColumnStoreDescript return nullptr; } + if (op.GetColumnShardCount() == 0) { + status = NKikimrScheme::StatusSchemeError; + errStr = Sprintf("trying to create OLAP store without zero shards"); + return nullptr; + } + op.SetNextSchemaPresetId(1); op.SetNextTtlSettingsPresetId(1); diff --git a/ydb/services/ydb/ydb_logstore_ut.cpp b/ydb/services/ydb/ydb_logstore_ut.cpp index 5b5c3205da7..3e768dee95f 100644 --- a/ydb/services/ydb/ydb_logstore_ut.cpp +++ b/ydb/services/ydb/ydb_logstore_ut.cpp @@ -121,6 +121,16 @@ Y_UNIT_TEST_SUITE(YdbLogStore) { auto res = logStoreClient.DropLogStore("/Root/LogStore").GetValueSync(); UNIT_ASSERT_VALUES_EQUAL_C(res.GetStatus(), EStatus::SUCCESS, res.GetIssues().ToString()); } + + // negative + { + NYdb::NLogStore::TSchema logSchema(TestSchemaColumns(pkField), TestSchemaKey()); + THashMap<TString, NYdb::NLogStore::TSchema> schemaPresets; + schemaPresets["default"] = logSchema; + NYdb::NLogStore::TLogStoreDescription storeDescr(0, schemaPresets); + auto res = logStoreClient.CreateLogStore("/Root/LogStore1", std::move(storeDescr)).GetValueSync(); + UNIT_ASSERT_VALUES_EQUAL_C(res.GetStatus(), EStatus::SCHEME_ERROR, res.GetIssues().ToString()); + } } Y_UNIT_TEST(LogStore) { |