diff options
author | barkovbg <barkovbg@yandex-team.com> | 2023-08-03 21:45:27 +0300 |
---|---|---|
committer | barkovbg <barkovbg@yandex-team.com> | 2023-08-03 21:45:27 +0300 |
commit | f1982df1d224cd5feec6e5b09f7cf937729b8225 (patch) | |
tree | a67838c759296b5f73d0da4cb244391f0331658e | |
parent | 8f87c3af48e9bb2599b32339d26776bf931161e1 (diff) | |
download | ydb-f1982df1d224cd5feec6e5b09f7cf937729b8225.tar.gz |
[blockstore]check fillTolen in alter volume transaction
-rw-r--r-- | ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp | 9 | ||||
-rw-r--r-- | ydb/core/tx/schemeshard/ut_base.cpp | 46 |
2 files changed, 55 insertions, 0 deletions
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp index b093866373..23e6e85f38 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp @@ -531,6 +531,15 @@ public: return result; } + if (alterVolumeConfig->HasFillToken() && + alterVolumeConfig->GetFillToken() != volume->VolumeConfig.GetFillToken()) + { + result->SetError( + NKikimrScheme::StatusPreconditionFailed, + "Wrong FillToken in VolumeConfig"); + return result; + } + if (!context.SS->CheckApplyIf(Transaction, errStr)) { result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr); return result; diff --git a/ydb/core/tx/schemeshard/ut_base.cpp b/ydb/core/tx/schemeshard/ut_base.cpp index cce8f5bc2e..a998236c9e 100644 --- a/ydb/core/tx/schemeshard/ut_base.cpp +++ b/ydb/core/tx/schemeshard/ut_base.cpp @@ -8328,6 +8328,52 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) { env.TestWaitNotification(runtime, txId); } + Y_UNIT_TEST(AssignBlockStoreCheckFillTokenInAlter) { //+ + TTestBasicRuntime runtime; + TTestEnv env(runtime); + ui64 txId = 100; + + NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr; + vdescr.SetName("BSVolume"); + auto& vc = *vdescr.MutableVolumeConfig(); + vc.SetBlockSize(4096); + vc.SetFillToken("barkovbg"); + vc.AddPartitions()->SetBlockCount(16); + vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1"); + vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1"); + vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1"); + vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1"); + + TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString()); + env.TestWaitNotification(runtime, txId); + vc.Clear(); + + vc.SetFillToken("barkovbg"); + vc.AddPartitions()->SetBlockCount(24); + vc.AddPartitions()->SetBlockCount(24); + + TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString()); + env.TestWaitNotification(runtime, txId); + vc.Clear(); + + vc.SetFillToken("svartmetal"); + vc.AddPartitions()->SetBlockCount(25); + vc.AddPartitions()->SetBlockCount(25); + + TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot", + vdescr.DebugString(), + {NKikimrScheme::StatusPreconditionFailed}); + env.TestWaitNotification(runtime, txId); + vc.Clear(); + + vc.SetFillToken("barkovbg"); + vc.AddPartitions()->SetBlockCount(48); + vc.AddPartitions()->SetBlockCount(48); + + TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString()); + env.TestWaitNotification(runtime, txId); + } + Y_UNIT_TEST(BlockStoreVolumeLimits) { //+ TTestBasicRuntime runtime; TTestEnv env(runtime); |