diff options
author | Ilnaz Nizametdinov <i.nizametdinov@gmail.com> | 2022-05-06 17:58:44 +0300 |
---|---|---|
committer | Ilnaz Nizametdinov <i.nizametdinov@gmail.com> | 2022-05-06 17:58:44 +0300 |
commit | 9f558f1f113dee87ce6a327b025e70e2767c57e9 (patch) | |
tree | 1f03643119e011cba4c11afe2d5b781d928b04d0 | |
parent | 5662c5b94ec2ab7febfa25285471de450df300a7 (diff) | |
download | ydb-9f558f1f113dee87ce6a327b025e70e2767c57e9.tar.gz |
Remove TTL settings from backup tables KIKIMR-14874
ref:a4e4733ce371719ba70d348afbd73d12588d04ed
-rw-r--r-- | ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp | 8 | ||||
-rw-r--r-- | ydb/core/tx/schemeshard/ut_ttl.cpp | 37 |
2 files changed, 44 insertions, 1 deletions
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp index 5d1e83187f..b143938797 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp @@ -482,11 +482,17 @@ public: auto schema = Transaction.GetCreateTable(); const bool omitFollowers = schema.GetOmitFollowers(); const bool isBackup = schema.GetIsBackup(); + PrepareScheme(&schema, name, srcTableInfo, context); + schema.SetIsBackup(isBackup); + if (omitFollowers) { schema.MutablePartitionConfig()->AddFollowerGroups()->Clear(); } - schema.SetIsBackup(isBackup); + + if (isBackup) { + schema.ClearTTLSettings(); + } NKikimrSchemeOp::TPartitionConfig compilationPartitionConfig; if (!TPartitionConfigMerger::ApplyChanges(compilationPartitionConfig, srcTableInfo->PartitionConfig(), schema.GetPartitionConfig(), AppData(), errStr) diff --git a/ydb/core/tx/schemeshard/ut_ttl.cpp b/ydb/core/tx/schemeshard/ut_ttl.cpp index 970e7c4bb9..82a554c66e 100644 --- a/ydb/core/tx/schemeshard/ut_ttl.cpp +++ b/ydb/core/tx/schemeshard/ut_ttl.cpp @@ -662,6 +662,43 @@ Y_UNIT_TEST_SUITE(TSchemeShardTTLTests) { } } + Y_UNIT_TEST(BackupCopyHasNoTtlSettings) { + TTestBasicRuntime runtime; + TTestEnv env(runtime); + ui64 txId = 100; + + TestCreateTable(runtime, ++txId, "/MyRoot", R"( + Name: "TTLEnabledTable" + Columns { Name: "key" Type: "Uint64" } + Columns { Name: "ts" Type: "Timestamp" } + KeyColumnNames: ["key"] + TTLSettings { + Enabled { + ColumnName: "ts" + } + } + )"); + env.TestWaitNotification(runtime, txId); + + TestConsistentCopyTables(runtime, ++txId, "/", R"( + CopyTableDescriptions { + SrcPath: "/MyRoot/TTLEnabledTable" + DstPath: "/MyRoot/TTLEnabledTableCopy" + IsBackup: true + } + )"); + env.TestWaitNotification(runtime, txId); + + TestDescribeResult( + DescribePath(runtime, "/MyRoot/TTLEnabledTableCopy"), { + NLs::PathExist, + NLs::Finished, [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) { + UNIT_ASSERT(!record.GetPathDescription().GetTable().HasTTLSettings()); + } + } + ); + } + Y_UNIT_TEST(RacyAlterTableAndConditionalErase) { TTestBasicRuntime runtime; TTestEnv env(runtime); |