aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlad-serikov <vlad-serikov@yandex-team.com>2023-09-19 12:49:41 +0300
committervlad-serikov <vlad-serikov@yandex-team.com>2023-09-19 13:33:14 +0300
commit0e99ae0e0cf85aea57f3edd74d1a7ea1ab2610d5 (patch)
treef48fa4d1d38f71162b0de3d6c394789bb7ac3070
parentaedad0ab3592b1f3d3ff3e2c0ff598116e2fb7f2 (diff)
downloadydb-0e99ae0e0cf85aea57f3edd74d1a7ea1ab2610d5.tar.gz
: Fix ForgetAlter method.
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_info_types.h6
-rw-r--r--ydb/core/tx/schemeshard/ut_filestore_reboots/ut_filestore_reboots.cpp65
2 files changed, 69 insertions, 2 deletions
diff --git a/ydb/core/tx/schemeshard/schemeshard_info_types.h b/ydb/core/tx/schemeshard/schemeshard_info_types.h
index 392c44c965..2df40b4ea1 100644
--- a/ydb/core/tx/schemeshard/schemeshard_info_types.h
+++ b/ydb/core/tx/schemeshard/schemeshard_info_types.h
@@ -2339,7 +2339,10 @@ struct TFileStoreInfo : public TSimpleRefCount<TFileStoreInfo> {
void ForgetAlter() {
Y_VERIFY(AlterConfig);
+ Y_VERIFY(AlterVersion);
+
AlterConfig.Reset();
+ AlterVersion = 0;
}
void FinishAlter() {
@@ -2350,8 +2353,7 @@ struct TFileStoreInfo : public TSimpleRefCount<TFileStoreInfo> {
++Version;
Y_VERIFY(Version == AlterVersion);
- AlterConfig.Reset();
- AlterVersion = 0;
+ ForgetAlter();
}
TFileStoreSpace GetFileStoreSpace() const {
diff --git a/ydb/core/tx/schemeshard/ut_filestore_reboots/ut_filestore_reboots.cpp b/ydb/core/tx/schemeshard/ut_filestore_reboots/ut_filestore_reboots.cpp
index 69dd567237..6f35d60108 100644
--- a/ydb/core/tx/schemeshard/ut_filestore_reboots/ut_filestore_reboots.cpp
+++ b/ydb/core/tx/schemeshard/ut_filestore_reboots/ut_filestore_reboots.cpp
@@ -359,4 +359,69 @@ Y_UNIT_TEST_SUITE(TFileStoreWithReboots) {
CheckLimits(3, 1); // hdd, ssd
CheckLimits(2, 1); // hybrid, ssd
}
+
+ Y_UNIT_TEST(CheckMultipleAlterWithStorageLimitsError) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestUserAttrs(
+ runtime,
+ ++txId,
+ "",
+ "MyRoot",
+ AlterUserAttrs({
+ {"__filestore_space_limit_ssd", ToString(32 * 4_KB)}
+ })
+ );
+ env.TestWaitNotification(runtime, txId);
+
+ NKikimrSchemeOp::TFileStoreDescription vdescr;
+ auto& vc = *vdescr.MutableConfig();
+ vc.SetStorageMediaKind(1);
+ vc.SetBlockSize(4_KB);
+ vc.SetBlocksCount(32);
+ vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1");
+
+ vdescr.SetName("FS");
+ TestCreateFileStore(runtime, ++txId, "/MyRoot", vdescr.DebugString());
+ env.TestWaitNotification(runtime, txId);
+
+ vc.ClearBlockSize();
+ vc.SetBlocksCount(33);
+ vc.SetVersion(1);
+ TestAlterFileStore(
+ runtime,
+ ++txId,
+ "/MyRoot",
+ vdescr.DebugString(),
+ {NKikimrScheme::StatusPreconditionFailed}
+ );
+ env.TestWaitNotification(runtime, txId);
+
+ TestAlterFileStore(
+ runtime,
+ ++txId,
+ "/MyRoot",
+ vdescr.DebugString(),
+ {NKikimrScheme::StatusPreconditionFailed}
+ );
+ env.TestWaitNotification(runtime, txId);
+
+ // It's possible to modify quota size
+ TestUserAttrs(
+ runtime,
+ ++txId,
+ "",
+ "MyRoot",
+ AlterUserAttrs({
+ {"__filestore_space_limit_ssd", ToString(33 * 4_KB)}
+ })
+ );
+ env.TestWaitNotification(runtime, txId);
+
+ // Ok
+ TestAlterFileStore(runtime, ++txId, "/MyRoot", vdescr.DebugString());
+ env.TestWaitNotification(runtime, txId);
+ }
}