aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorilnaz <ilnaz@ydb.tech>2022-12-20 15:49:16 +0300
committerilnaz <ilnaz@ydb.tech>2022-12-20 15:49:16 +0300
commit4e5218a3dbf16e1338da83eff587415f356c97c0 (patch)
tree296e39dca823bb1c9b9c5d91945295cc17aa9954
parent74eb54d566679060e4e16811a2718bdef8e1c0f9 (diff)
downloadydb-4e5218a3dbf16e1338da83eff587415f356c97c0.tar.gz
Reset cached path
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_info_types.cpp1
-rw-r--r--ydb/core/tx/schemeshard/ut_move.cpp41
2 files changed, 42 insertions, 0 deletions
diff --git a/ydb/core/tx/schemeshard/schemeshard_info_types.cpp b/ydb/core/tx/schemeshard/schemeshard_info_types.cpp
index 0a301b7be9b..44f4f957dc5 100644
--- a/ydb/core/tx/schemeshard/schemeshard_info_types.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_info_types.cpp
@@ -287,6 +287,7 @@ TTableInfo::TAlterDataPtr TTableInfo::CreateAlterData(
void TTableInfo::ResetDescriptionCache() {
TableDescription.ClearId_Deprecated();
TableDescription.ClearPathId();
+ TableDescription.ClearPath();
TableDescription.ClearName();
TableDescription.ClearColumns();
TableDescription.ClearKeyColumnIds();
diff --git a/ydb/core/tx/schemeshard/ut_move.cpp b/ydb/core/tx/schemeshard/ut_move.cpp
index fe66eba3703..5d3f270468c 100644
--- a/ydb/core/tx/schemeshard/ut_move.cpp
+++ b/ydb/core/tx/schemeshard/ut_move.cpp
@@ -662,6 +662,47 @@ Y_UNIT_TEST_SUITE(TSchemeShardMoveTest) {
NLs::ShardsInsideDomain(0)});
}
+ Y_UNIT_TEST(ResetCachedPath) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint32" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ // split table to cache current path
+ TestSplitTable(runtime, ++txId, "/MyRoot/Table", Sprintf(R"(
+ SourceTabletId: %lu
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint32: 2 } }
+ }
+ }
+ )", TTestTxConfig::FakeHiveTablets));
+ env.TestWaitNotification(runtime, txId);
+
+ TestMoveTable(runtime, ++txId, "/MyRoot/Table", "/MyRoot/TableMove");
+ env.TestWaitNotification(runtime, txId);
+
+ // another split to override path with a previously cached value
+ TestSplitTable(runtime, ++txId, "/MyRoot/TableMove", Sprintf(R"(
+ SourceTabletId: %lu
+ SourceTabletId: %lu
+ )", TTestTxConfig::FakeHiveTablets + 1, TTestTxConfig::FakeHiveTablets + 2));
+ env.TestWaitNotification(runtime, txId);
+
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "TableMove"
+ Columns { Name: "add" Type: "Utf8" }
+ )");
+ env.TestWaitNotification(runtime, txId);
+ }
+
Y_UNIT_TEST(Index) {
TTestBasicRuntime runtime;
TTestEnv env(runtime);