aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorilnaz <ilnaz@ydb.tech>2023-08-01 00:02:53 +0300
committerilnaz <ilnaz@ydb.tech>2023-08-01 00:02:53 +0300
commit2562cbfa09ddbc00e5a23b6c05c58cf3ba1d9c5a (patch)
tree82b77511a0d3e8c2ebffd406d5007013ef6ff340
parent60505ca329249a2c65c3117d345dfb3088bb3098 (diff)
downloadydb-2562cbfa09ddbc00e5a23b6c05c58cf3ba1d9c5a.tar.gz
Get rid of excessive checks KIKIMR-18899
-rw-r--r--ydb/core/base/appdata.h3
-rw-r--r--ydb/core/tx/datashard/datashard.cpp2
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_impl.cpp4
-rw-r--r--ydb/core/tx/schemeshard/ut_move.cpp25
4 files changed, 32 insertions, 2 deletions
diff --git a/ydb/core/base/appdata.h b/ydb/core/base/appdata.h
index 648080bd6b6..0ebec11ee2b 100644
--- a/ydb/core/base/appdata.h
+++ b/ydb/core/base/appdata.h
@@ -176,6 +176,9 @@ struct TAppData {
// Used to disable object deletion in schemeshard for cleanup tests
bool DisableSchemeShardCleanupOnDropForTest = false;
+ // Used to exclude indexes, cdc streams & sequences from table description on DataShards
+ bool DisableRichTableDescriptionForTest = false;
+
TMaybe<ui32> ZstdBlockSizeForTest;
// Used to disable checking nodes with sys tablets only in cms
diff --git a/ydb/core/tx/datashard/datashard.cpp b/ydb/core/tx/datashard/datashard.cpp
index 2fae2da7fd9..4a2b8394a58 100644
--- a/ydb/core/tx/datashard/datashard.cpp
+++ b/ydb/core/tx/datashard/datashard.cpp
@@ -1459,7 +1459,6 @@ TUserTable::TPtr TDataShard::MoveUserTable(TOperation::TPtr op, const NKikimrTxD
auto newTableInfo = AlterTableSchemaVersion(ctx, txc, prevId, version, false);
newTableInfo->SetPath(move.GetDstPath());
- Y_VERIFY(move.ReMapIndexesSize() == newTableInfo->Indexes.size());
const THashMap<TPathId, TPathId> remap = GetRemapIndexes(move);
NKikimrSchemeOp::TTableDescription schema;
@@ -1477,7 +1476,6 @@ TUserTable::TPtr TDataShard::MoveUserTable(TOperation::TPtr op, const NKikimrTxD
newTableInfo->Indexes.erase(prevPathId);
}
newTableInfo->SetSchema(schema);
- Y_VERIFY(move.ReMapIndexesSize() == newTableInfo->Indexes.size());
//NOTE: Stats building is bound to table id, but move-table changes table id,
// so already built stats couldn't be inherited by moved table
diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.cpp b/ydb/core/tx/schemeshard/schemeshard_impl.cpp
index 37dbeb0e361..4814d84a53b 100644
--- a/ydb/core/tx/schemeshard/schemeshard_impl.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_impl.cpp
@@ -6230,6 +6230,10 @@ void TSchemeShard::FillTableDescriptionForShardIdx(
tableDescr->MutableReplicationConfig()->CopyFrom(tinfo->ReplicationConfig());
}
+ if (AppData()->DisableRichTableDescriptionForTest) {
+ return;
+ }
+
// Fill indexes & cdc streams (if any)
for (const auto& child : pinfo->GetChildren()) {
const auto& childName = child.first;
diff --git a/ydb/core/tx/schemeshard/ut_move.cpp b/ydb/core/tx/schemeshard/ut_move.cpp
index 19dc9f139ef..70c976fe01d 100644
--- a/ydb/core/tx/schemeshard/ut_move.cpp
+++ b/ydb/core/tx/schemeshard/ut_move.cpp
@@ -1166,4 +1166,29 @@ Y_UNIT_TEST_SUITE(TSchemeShardMoveTest) {
NLs::PathVersionEqual(5),
NLs::CheckColumns("TableMove", {"key", "value"}, {}, {"key"})});
}
+
+ Y_UNIT_TEST(MoveOldTableWithIndex) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ runtime.GetAppData().DisableRichTableDescriptionForTest = true;
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
+ TableDescription {
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "ByValue"
+ KeyColumnNames: ["value"]
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestMoveTable(runtime, ++txId, "/MyRoot/Table", "/MyRoot/TableMove");
+ env.TestWaitNotification(runtime, txId);
+ }
}