Skip to content

Commit

Permalink
Fix move table with sequences (ydb-platform#9709)
Browse files Browse the repository at this point in the history
  • Loading branch information
shnikd authored and rekby committed Sep 24, 2024
1 parent cf65456 commit 8bac8da
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ TVector<ISubOperation::TPtr> CreateConsistentMoveTable(TOperationId nextId, cons
return {CreateReject(nextId, NKikimrScheme::StatusPreconditionFailed, "Cannot move table with cdc streams")};
}

if (srcChildPath.IsSequence()) {
return {CreateReject(nextId, NKikimrScheme::StatusPreconditionFailed, "Cannot move table with sequences")};
}

TPath dstIndexPath = dstPath.Child(name);

Y_ABORT_UNLESS(srcChildPath.Base()->PathId == child.second);
Expand Down
21 changes: 21 additions & 0 deletions ydb/core/tx/schemeshard/ut_move/ut_move.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1190,4 +1190,25 @@ Y_UNIT_TEST_SUITE(TSchemeShardMoveTest) {
TestMoveTable(runtime, ++txId, "/MyRoot/Table", "/MyRoot/TableMove");
env.TestWaitNotification(runtime, txId);
}

Y_UNIT_TEST(MoveTableWithSequence) {
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;

TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
TableDescription {
Name: "Table"
Columns { Name: "key" Type: "Uint64" DefaultFromSequence: "myseq" }
Columns { Name: "value" Type: "Uint64" }
KeyColumnNames: ["key"]
}
SequenceDescription {
Name: "myseq"
}
)");
env.TestWaitNotification(runtime, txId);

TestMoveTable(runtime, ++txId, "/MyRoot/Table", "/MyRoot/TableMove", {NKikimrScheme::StatusPreconditionFailed});
}
}

0 comments on commit 8bac8da

Please sign in to comment.