diff options
author | svartmetal <svartmetal@yandex-team.ru> | 2022-02-10 16:52:22 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:52:22 +0300 |
commit | 68bd6973dfbeee84e541d5bb9fce72847d9076d6 (patch) | |
tree | feda89451efc1182ed9f31ac03f06f8fa4cc3a5d | |
parent | 35f43338cef7daffb06804cb398ca0a31c9a7687 (diff) | |
download | ydb-68bd6973dfbeee84e541d5bb9fce72847d9076d6.tar.gz |
Restoring authorship annotation for <svartmetal@yandex-team.ru>. Commit 1 of 2.
-rw-r--r-- | ydb/core/protos/blockstore_config.proto | 12 | ||||
-rw-r--r-- | ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp | 2 | ||||
-rw-r--r-- | ydb/core/tx/schemeshard/schemeshard_info_types.h | 14 | ||||
-rw-r--r-- | ydb/core/tx/schemeshard/schemeshard_path_element.h | 36 | ||||
-rw-r--r-- | ydb/core/tx/schemeshard/ut_base.cpp | 234 | ||||
-rw-r--r-- | ydb/tests/library/harness/kikimr_cluster_interface.py | 2 | ||||
-rw-r--r-- | ydb/tests/library/harness/kikimr_config.py | 18 | ||||
-rw-r--r-- | ydb/tests/library/harness/kikimr_runner.py | 52 |
8 files changed, 185 insertions, 185 deletions
diff --git a/ydb/core/protos/blockstore_config.proto b/ydb/core/protos/blockstore_config.proto index 5cba383bfdc..da395aa3969 100644 --- a/ydb/core/protos/blockstore_config.proto +++ b/ydb/core/protos/blockstore_config.proto @@ -60,9 +60,9 @@ message TVolumeConfig { optional uint32 PerformanceProfileMaxWriteBandwidth = 23; optional uint32 PerformanceProfileMaxWriteIops = 24; optional uint32 PerformanceProfileBurstPercentage = 25; - - optional string BaseDiskId = 26; - optional string BaseDiskCheckpointId = 27; + + optional string BaseDiskId = 26; + optional string BaseDiskCheckpointId = 27; optional bool SizeDecreaseAllowed = 28; @@ -93,9 +93,9 @@ message TVolumeConfig { // Encryption key hash optional bytes EncryptionKeyHash = 39; - - // Indicates that volume does not belong to user directly, but used for system needs - optional bool IsSystem = 40; + + // Indicates that volume does not belong to user directly, but used for system needs + optional bool IsSystem = 40; // Channel descriptions for volume tablets repeated TChannelProfile VolumeExplicitChannelProfiles = 41; diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp index 27455e46270..70db80cbe80 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp @@ -191,7 +191,7 @@ public: // create new shards for (ui64 i = 0; i < shardsToCreate; ++i) { TShardIdx shardIdx; - if (volume->VolumeConfig.GetTabletVersion() == 2) { + if (volume->VolumeConfig.GetTabletVersion() == 2) { shardIdx = context.SS->RegisterShardInfo(TShardInfo::BlockStorePartition2Info(txId, pathId)); context.SS->TabletCounters->Simple()[COUNTER_BLOCKSTORE_PARTITION2_SHARD_COUNT].Add(1); } else { diff --git a/ydb/core/tx/schemeshard/schemeshard_info_types.h b/ydb/core/tx/schemeshard/schemeshard_info_types.h index 2e5710c3d3e..503ed851890 100644 --- a/ydb/core/tx/schemeshard/schemeshard_info_types.h +++ b/ydb/core/tx/schemeshard/schemeshard_info_types.h @@ -1951,12 +1951,12 @@ struct TBlockStoreVolumeInfo : public TSimpleRefCount<TBlockStoreVolumeInfo> { space.Raw += blockCount * blockSize; switch (VolumeConfig.GetStorageMediaKind()) { case 1: // STORAGE_MEDIA_SSD - if (VolumeConfig.GetIsSystem()) { - space.SSDSystem += blockCount * blockSize; // merged blobs - } else { - space.SSD += blockCount * blockSize; // merged blobs - space.SSD += (blockCount / 8) * blockSize; // mixed blobs - } + if (VolumeConfig.GetIsSystem()) { + space.SSDSystem += blockCount * blockSize; // merged blobs + } else { + space.SSD += blockCount * blockSize; // merged blobs + space.SSD += (blockCount / 8) * blockSize; // mixed blobs + } break; case 2: // STORAGE_MEDIA_HYBRID space.HDD += blockCount * blockSize; // merged blobs @@ -1977,7 +1977,7 @@ struct TBlockStoreVolumeInfo : public TSimpleRefCount<TBlockStoreVolumeInfo> { space.SSD = Max(space.SSD, altSpace.SSD); space.HDD = Max(space.HDD, altSpace.HDD); space.SSDNonrepl = Max(space.SSDNonrepl, altSpace.SSDNonrepl); - space.SSDSystem = Max(space.SSDSystem, altSpace.SSDSystem); + space.SSDSystem = Max(space.SSDSystem, altSpace.SSDSystem); } return space; diff --git a/ydb/core/tx/schemeshard/schemeshard_path_element.h b/ydb/core/tx/schemeshard/schemeshard_path_element.h index 9912880c057..41b41b996eb 100644 --- a/ydb/core/tx/schemeshard/schemeshard_path_element.h +++ b/ydb/core/tx/schemeshard/schemeshard_path_element.h @@ -21,7 +21,7 @@ constexpr TStringBuf ATTR_VOLUME_SPACE_LIMIT = "__volume_space_limit"; constexpr TStringBuf ATTR_VOLUME_SPACE_LIMIT_HDD = "__volume_space_limit_hdd"; constexpr TStringBuf ATTR_VOLUME_SPACE_LIMIT_SSD = "__volume_space_limit_ssd"; constexpr TStringBuf ATTR_VOLUME_SPACE_LIMIT_SSD_NONREPL = "__volume_space_limit_ssd_nonrepl"; -constexpr TStringBuf ATTR_VOLUME_SPACE_LIMIT_SSD_SYSTEM = "__volume_space_limit_ssd_system"; +constexpr TStringBuf ATTR_VOLUME_SPACE_LIMIT_SSD_SYSTEM = "__volume_space_limit_ssd_system"; constexpr TStringBuf ATTR_EXTRA_PATH_SYMBOLS_ALLOWED = "__extra_path_symbols_allowed"; constexpr TStringBuf ATTR_DOCUMENT_API_VERSION = "__document_api_version"; @@ -55,7 +55,7 @@ enum class EAttribute { EXTRA_PATH_SYMBOLS_ALLOWED, // deprecated VOLUME_SPACE_LIMIT_SSD_NONREPL, DOCUMENT_API_VERSION, - VOLUME_SPACE_LIMIT_SSD_SYSTEM, + VOLUME_SPACE_LIMIT_SSD_SYSTEM, }; struct TVolumeSpace { @@ -63,7 +63,7 @@ struct TVolumeSpace { ui64 SSD = 0; ui64 HDD = 0; ui64 SSDNonrepl = 0; - ui64 SSDSystem = 0; + ui64 SSDSystem = 0; }; struct TVolumeSpaceLimits { @@ -111,7 +111,7 @@ struct TUserAttributes: TSimpleRefCount<TUserAttributes> { HANDLE_ATTR(VOLUME_SPACE_LIMIT_HDD); HANDLE_ATTR(VOLUME_SPACE_LIMIT_SSD); HANDLE_ATTR(VOLUME_SPACE_LIMIT_SSD_NONREPL); - HANDLE_ATTR(VOLUME_SPACE_LIMIT_SSD_SYSTEM); + HANDLE_ATTR(VOLUME_SPACE_LIMIT_SSD_SYSTEM); HANDLE_ATTR(EXTRA_PATH_SYMBOLS_ALLOWED); HANDLE_ATTR(DOCUMENT_API_VERSION); #undef HANDLE_ATTR @@ -206,7 +206,7 @@ struct TUserAttributes: TSimpleRefCount<TUserAttributes> { case EAttribute::VOLUME_SPACE_LIMIT_HDD: case EAttribute::VOLUME_SPACE_LIMIT_SSD: case EAttribute::VOLUME_SPACE_LIMIT_SSD_NONREPL: - case EAttribute::VOLUME_SPACE_LIMIT_SSD_SYSTEM: + case EAttribute::VOLUME_SPACE_LIMIT_SSD_SYSTEM: return CheckAttributeUint64(name, value, errStr); case EAttribute::EXTRA_PATH_SYMBOLS_ALLOWED: return CheckAttributeStringWithWeakCheck(name, value, errStr); @@ -237,7 +237,7 @@ struct TUserAttributes: TSimpleRefCount<TUserAttributes> { case EAttribute::VOLUME_SPACE_LIMIT_HDD: case EAttribute::VOLUME_SPACE_LIMIT_SSD: case EAttribute::VOLUME_SPACE_LIMIT_SSD_NONREPL: - case EAttribute::VOLUME_SPACE_LIMIT_SSD_SYSTEM: + case EAttribute::VOLUME_SPACE_LIMIT_SSD_SYSTEM: case EAttribute::EXTRA_PATH_SYMBOLS_ALLOWED: return true; case EAttribute::DOCUMENT_API_VERSION: @@ -330,7 +330,7 @@ struct TPathElement : TSimpleRefCount<TPathElement> { TVolumeSpaceLimits VolumeSpaceSSD; TVolumeSpaceLimits VolumeSpaceHDD; TVolumeSpaceLimits VolumeSpaceSSDNonrepl; - TVolumeSpaceLimits VolumeSpaceSSDSystem; + TVolumeSpaceLimits VolumeSpaceSSDSystem; ui64 DocumentApiVersion = 0; // Number of references to this path element in the database @@ -560,7 +560,7 @@ public: VolumeSpaceSSD.Limit = Max<ui64>(); VolumeSpaceHDD.Limit = Max<ui64>(); VolumeSpaceSSDNonrepl.Limit = Max<ui64>(); - VolumeSpaceSSDSystem.Limit = Max<ui64>(); + VolumeSpaceSSDSystem.Limit = Max<ui64>(); ExtraPathSymbolsAllowed = TString(); for (const auto& item : UserAttrs->Attrs) { switch (TUserAttributes::ParseName(item.first)) { @@ -576,9 +576,9 @@ public: case EAttribute::VOLUME_SPACE_LIMIT_SSD_NONREPL: HandleAttributeValue(item.second, VolumeSpaceSSDNonrepl.Limit); break; - case EAttribute::VOLUME_SPACE_LIMIT_SSD_SYSTEM: - HandleAttributeValue(item.second, VolumeSpaceSSDSystem.Limit); - break; + case EAttribute::VOLUME_SPACE_LIMIT_SSD_SYSTEM: + HandleAttributeValue(item.second, VolumeSpaceSSDSystem.Limit); + break; case EAttribute::EXTRA_PATH_SYMBOLS_ALLOWED: HandleAttributeValue(item.second, ExtraPathSymbolsAllowed); break; @@ -613,7 +613,7 @@ public: update(VolumeSpaceSSD, newSpace.SSD, oldSpace.SSD); update(VolumeSpaceHDD, newSpace.HDD, oldSpace.HDD); update(VolumeSpaceSSDNonrepl, newSpace.SSDNonrepl, oldSpace.SSDNonrepl); - update(VolumeSpaceSSDSystem, newSpace.SSDSystem, oldSpace.SSDSystem); + update(VolumeSpaceSSDSystem, newSpace.SSDSystem, oldSpace.SSDSystem); } void ChangeVolumeSpaceCommit(TVolumeSpace newSpace, TVolumeSpace oldSpace) { @@ -629,7 +629,7 @@ public: update(VolumeSpaceSSD, newSpace.SSD, oldSpace.SSD); update(VolumeSpaceHDD, newSpace.HDD, oldSpace.HDD); update(VolumeSpaceSSDNonrepl, newSpace.SSDNonrepl, oldSpace.SSDNonrepl); - update(VolumeSpaceSSDSystem, newSpace.SSDSystem, oldSpace.SSDSystem); + update(VolumeSpaceSSDSystem, newSpace.SSDSystem, oldSpace.SSDSystem); } bool CheckVolumeSpaceChange(TVolumeSpace newSpace, TVolumeSpace oldSpace, TString& errStr) { @@ -648,16 +648,16 @@ public: return (check(VolumeSpaceRaw, newSpace.Raw, oldSpace.Raw, "") && check(VolumeSpaceSSD, newSpace.SSD, oldSpace.SSD, " (ssd)") && check(VolumeSpaceHDD, newSpace.HDD, oldSpace.HDD, " (hdd)") && - check(VolumeSpaceSSDNonrepl, newSpace.SSDNonrepl, oldSpace.SSDNonrepl, " (ssd_nonrepl)") && - check(VolumeSpaceSSDSystem, newSpace.SSDSystem, oldSpace.SSDSystem, " (ssd_system)")); + check(VolumeSpaceSSDNonrepl, newSpace.SSDNonrepl, oldSpace.SSDNonrepl, " (ssd_nonrepl)") && + check(VolumeSpaceSSDSystem, newSpace.SSDSystem, oldSpace.SSDSystem, " (ssd_system)")); } bool HasRuntimeAttrs() const { return (VolumeSpaceRaw.Allocated > 0 || VolumeSpaceSSD.Allocated > 0 || VolumeSpaceHDD.Allocated > 0 || - VolumeSpaceSSDNonrepl.Allocated > 0 || - VolumeSpaceSSDSystem.Allocated > 0); + VolumeSpaceSSDNonrepl.Allocated > 0 || + VolumeSpaceSSDSystem.Allocated > 0); } void SerializeRuntimeAttrs( @@ -674,7 +674,7 @@ public: process(VolumeSpaceSSD, "__volume_space_allocated_ssd"); process(VolumeSpaceHDD, "__volume_space_allocated_hdd"); process(VolumeSpaceSSDNonrepl, "__volume_space_allocated_ssd_nonrepl"); - process(VolumeSpaceSSDSystem, "__volume_space_allocated_ssd_system"); + process(VolumeSpaceSSDSystem, "__volume_space_allocated_ssd_system"); } }; diff --git a/ydb/core/tx/schemeshard/ut_base.cpp b/ydb/core/tx/schemeshard/ut_base.cpp index a76dcf9d5bb..b3781ef134a 100644 --- a/ydb/core/tx/schemeshard/ut_base.cpp +++ b/ydb/core/tx/schemeshard/ut_base.cpp @@ -7825,7 +7825,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) { TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"), {NLs::CheckMountToken("BSVolume", "Owner124")}); - + // AssignVolume using TokenVersion TestAssignBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume", "Owner125", 2); @@ -8299,125 +8299,125 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) { env.TestWaitNotification(runtime, txId); } - Y_UNIT_TEST(BlockStoreSystemVolumeLimits) { //+ - TTestBasicRuntime runtime; - TTestEnv env(runtime); - ui64 txId = 100; - - TestUserAttrs( - runtime, - ++txId, - "", - "MyRoot", - AlterUserAttrs({{ - "__volume_space_limit_ssd_system", - ToString(32 * 4_KB) - }}) - ); - env.TestWaitNotification(runtime, txId); - - // Other pool kinds should not be affected + Y_UNIT_TEST(BlockStoreSystemVolumeLimits) { //+ + TTestBasicRuntime runtime; + TTestEnv env(runtime); + ui64 txId = 100; + + TestUserAttrs( + runtime, + ++txId, + "", + "MyRoot", + AlterUserAttrs({{ + "__volume_space_limit_ssd_system", + ToString(32 * 4_KB) + }}) + ); + env.TestWaitNotification(runtime, txId); + + // Other pool kinds should not be affected NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr; - auto& vc = *vdescr.MutableVolumeConfig(); - vc.SetStorageMediaKind(1); - vc.SetBlockSize(4_KB); - vc.AddPartitions()->SetBlockCount(100500); - vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1"); - - vdescr.SetName("BSVolumeOther"); - TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString()); - env.TestWaitNotification(runtime, txId); - - // Creating a SSD system volume - vdescr.SetName("BSVolume1"); - vc.SetIsSystem(true); - vc.MutablePartitions(0)->SetBlockCount(16); - TestCreateBlockStoreVolume( - runtime, - ++txId, - "/MyRoot", - vdescr.DebugString() - ); - env.TestWaitNotification(runtime, txId); - - // Cannot have more than quota - vdescr.SetName("BSVolume2"); - vc.MutablePartitions(0)->SetBlockCount(17); - TestCreateBlockStoreVolume( - runtime, - ++txId, - "/MyRoot", - vdescr.DebugString(), + auto& vc = *vdescr.MutableVolumeConfig(); + vc.SetStorageMediaKind(1); + vc.SetBlockSize(4_KB); + vc.AddPartitions()->SetBlockCount(100500); + vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1"); + + vdescr.SetName("BSVolumeOther"); + TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString()); + env.TestWaitNotification(runtime, txId); + + // Creating a SSD system volume + vdescr.SetName("BSVolume1"); + vc.SetIsSystem(true); + vc.MutablePartitions(0)->SetBlockCount(16); + TestCreateBlockStoreVolume( + runtime, + ++txId, + "/MyRoot", + vdescr.DebugString() + ); + env.TestWaitNotification(runtime, txId); + + // Cannot have more than quota + vdescr.SetName("BSVolume2"); + vc.MutablePartitions(0)->SetBlockCount(17); + TestCreateBlockStoreVolume( + runtime, + ++txId, + "/MyRoot", + vdescr.DebugString(), {NKikimrScheme::StatusPreconditionFailed} - ); - env.TestWaitNotification(runtime, txId); - - // It's ok to use quota completely, but only the first create should succeed - vdescr.SetName("BSVolume2"); - vc.MutablePartitions(0)->SetBlockCount(16); - TestCreateBlockStoreVolume( - runtime, - ++txId, - "/MyRoot", - vdescr.DebugString() - ); - env.TestWaitNotification(runtime, txId); - - // We may drop a volume and then use freed quota in an alter - TestDropBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume1"); - env.TestWaitNotification(runtime, txId); - - vc.Clear(); - vdescr.SetName("BSVolume2"); - vc.AddPartitions()->SetBlockCount(32); - vc.SetVersion(1); - TestAlterBlockStoreVolume( - runtime, - ++txId, - "/MyRoot", - vdescr.DebugString() - ); - env.TestWaitNotification(runtime, txId); - - // Cannot have more than quota - vdescr.SetName("BSVolume3"); - vc.SetIsSystem(true); - vc.SetStorageMediaKind(1); - vc.SetBlockSize(4_KB); - vc.MutablePartitions(0)->SetBlockCount(1); - vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1"); - vc.ClearVersion(); - TestCreateBlockStoreVolume( - runtime, - ++txId, - "/MyRoot", - vdescr.DebugString(), + ); + env.TestWaitNotification(runtime, txId); + + // It's ok to use quota completely, but only the first create should succeed + vdescr.SetName("BSVolume2"); + vc.MutablePartitions(0)->SetBlockCount(16); + TestCreateBlockStoreVolume( + runtime, + ++txId, + "/MyRoot", + vdescr.DebugString() + ); + env.TestWaitNotification(runtime, txId); + + // We may drop a volume and then use freed quota in an alter + TestDropBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume1"); + env.TestWaitNotification(runtime, txId); + + vc.Clear(); + vdescr.SetName("BSVolume2"); + vc.AddPartitions()->SetBlockCount(32); + vc.SetVersion(1); + TestAlterBlockStoreVolume( + runtime, + ++txId, + "/MyRoot", + vdescr.DebugString() + ); + env.TestWaitNotification(runtime, txId); + + // Cannot have more than quota + vdescr.SetName("BSVolume3"); + vc.SetIsSystem(true); + vc.SetStorageMediaKind(1); + vc.SetBlockSize(4_KB); + vc.MutablePartitions(0)->SetBlockCount(1); + vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1"); + vc.ClearVersion(); + TestCreateBlockStoreVolume( + runtime, + ++txId, + "/MyRoot", + vdescr.DebugString(), {NKikimrScheme::StatusPreconditionFailed} - ); - - // It's possible to modify quota size - TestUserAttrs( - runtime, - ++txId, - "", - "MyRoot", - AlterUserAttrs({{ - "__volume_space_limit_ssd_system", - ToString(33 * 4_KB) - }}) - ); - env.TestWaitNotification(runtime, txId); - - // Ok - TestCreateBlockStoreVolume( - runtime, - ++txId, - "/MyRoot", - vdescr.DebugString() - ); - env.TestWaitNotification(runtime, txId); - } - + ); + + // It's possible to modify quota size + TestUserAttrs( + runtime, + ++txId, + "", + "MyRoot", + AlterUserAttrs({{ + "__volume_space_limit_ssd_system", + ToString(33 * 4_KB) + }}) + ); + env.TestWaitNotification(runtime, txId); + + // Ok + TestCreateBlockStoreVolume( + runtime, + ++txId, + "/MyRoot", + vdescr.DebugString() + ); + env.TestWaitNotification(runtime, txId); + } + Y_UNIT_TEST(CreateAlterBlockStoreVolumeWithInvalidPoolKinds) { //+ TTestBasicRuntime runtime; TTestEnv env(runtime, /* nchannels */ 6); diff --git a/ydb/tests/library/harness/kikimr_cluster_interface.py b/ydb/tests/library/harness/kikimr_cluster_interface.py index 96a891da11b..c93c022be6f 100644 --- a/ydb/tests/library/harness/kikimr_cluster_interface.py +++ b/ydb/tests/library/harness/kikimr_cluster_interface.py @@ -65,7 +65,7 @@ class KiKiMRClusterInterface(object): pass @abc.abstractmethod - def add_storage_pool(self, name=None, kind="rot", pdisk_user_kind=0, erasure=None): + def add_storage_pool(self, name=None, kind="rot", pdisk_user_kind=0, erasure=None): """ Adds storage pool to the cluster :param erasure: Erasure for storage pool diff --git a/ydb/tests/library/harness/kikimr_config.py b/ydb/tests/library/harness/kikimr_config.py index 57c282b9f41..b3ef597b128 100644 --- a/ydb/tests/library/harness/kikimr_config.py +++ b/ydb/tests/library/harness/kikimr_config.py @@ -95,9 +95,9 @@ class KikimrConfigGenerator(object): enable_sqs=False, domain_name='Root', suppress_version_check=True, - static_pdisk_size=PDISK_SIZE, - dynamic_pdisk_size=PDISK_SIZE, - dynamic_pdisks=[], + static_pdisk_size=PDISK_SIZE, + dynamic_pdisk_size=PDISK_SIZE, + dynamic_pdisks=[], dynamic_storage_pools=[dict(name="dynamic_storage_pool:1", kind="hdd", pdisk_user_kind=0)], n_to_select=None, use_log_files=True, @@ -116,7 +116,7 @@ class KikimrConfigGenerator(object): self.use_log_files = use_log_files self.suppress_version_check = suppress_version_check self._pdisk_store_path = pdisk_store_path - self.static_pdisk_size = static_pdisk_size + self.static_pdisk_size = static_pdisk_size self.app_config = config_pb2.TAppConfig() self.port_allocator = KikimrPortManagerPortAllocator() if port_allocator is None else port_allocator erasure = Erasure.NONE if erasure is None else erasure @@ -154,7 +154,7 @@ class KikimrConfigGenerator(object): self.__use_in_memory_pdisks = use_in_memory_pdisks or os.getenv('YDB_USE_IN_MEMORY_PDISKS') == 'true' self.static_erasure = erasure self.domain_name = domain_name - self.__number_of_pdisks_per_node = 1 + len(dynamic_pdisks) + self.__number_of_pdisks_per_node = 1 + len(dynamic_pdisks) self.__load_udfs = load_udfs self.__udfs_path = udfs_path self.__yql_config_path = yql_config_path @@ -167,11 +167,11 @@ class KikimrConfigGenerator(object): self.__additional_log_configs = {} if additional_log_configs is None else additional_log_configs self.__additional_log_configs.update(get_additional_log_configs()) - self.dynamic_pdisk_size = dynamic_pdisk_size - self.dynamic_storage_pools = dynamic_storage_pools - + self.dynamic_pdisk_size = dynamic_pdisk_size + self.dynamic_storage_pools = dynamic_storage_pools + self.__dynamic_pdisks = dynamic_pdisks - + self.__output_path = output_path or yatest_common.output_path() self.yaml_config = load_default_yaml(self.__node_ids, self.domain_name, self.static_erasure, self.n_to_select, self.__node_ids, self.__additional_log_configs) diff --git a/ydb/tests/library/harness/kikimr_runner.py b/ydb/tests/library/harness/kikimr_runner.py index 251f485b5db..7bfaf1bcce9 100644 --- a/ydb/tests/library/harness/kikimr_runner.py +++ b/ydb/tests/library/harness/kikimr_runner.py @@ -107,10 +107,10 @@ class KiKiMRNode(daemon.Daemon, kikimr_node_interface.NodeInterface): if pdisk_path.startswith('SectorMap'): return - with open(pdisk_path, "wb") as out: - out.seek(disk_size - 1) + with open(pdisk_path, "wb") as out: + out.seek(disk_size - 1) out.write(b'\0') - + def __make_run_command(self): command = [self.__configurator.binary_path, "server"] if self.__common_udfs_dir is not None: @@ -293,18 +293,18 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface): self.__add_bs_box() pools = {} - - for p in self.__configurator.dynamic_storage_pools: - self.add_storage_pool( - name=p['name'], - kind=p['kind'], - pdisk_user_kind=p['pdisk_user_kind'], - ) + + for p in self.__configurator.dynamic_storage_pools: + self.add_storage_pool( + name=p['name'], + kind=p['kind'], + pdisk_user_kind=p['pdisk_user_kind'], + ) pools[p['name']] = p['kind'] - - self.client.bind_storage_pools(self.domain_name, pools) + + self.client.bind_storage_pools(self.domain_name, pools) default_pool_name = list(pools.keys())[0] - self.default_channel_bindings = {idx: default_pool_name for idx in range(3)} + self.default_channel_bindings = {idx: default_pool_name for idx in range(3)} logger.info("Cluster started and initialized") self.client.add_config_item( @@ -480,28 +480,28 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface): if retries == 0: raise - def add_storage_pool(self, name=None, kind="rot", pdisk_user_kind=0, erasure=None): + def add_storage_pool(self, name=None, kind="rot", pdisk_user_kind=0, erasure=None): if erasure is None: erasure = self.__configurator.static_erasure request = bs.TConfigRequest() cmd = request.Command.add() cmd.DefineStoragePool.BoxId = 1 - - pool_id = cmd.DefineStoragePool.StoragePoolId = next(self.__storage_pool_id_allocator) - if name is None: - name = "dynamic_storage_pool:%s" % pool_id - cmd.DefineStoragePool.StoragePoolId = pool_id - cmd.DefineStoragePool.Name = name - cmd.DefineStoragePool.Kind = kind + + pool_id = cmd.DefineStoragePool.StoragePoolId = next(self.__storage_pool_id_allocator) + if name is None: + name = "dynamic_storage_pool:%s" % pool_id + cmd.DefineStoragePool.StoragePoolId = pool_id + cmd.DefineStoragePool.Name = name + cmd.DefineStoragePool.Kind = kind cmd.DefineStoragePool.ErasureSpecies = str(erasure) cmd.DefineStoragePool.VDiskKind = "Default" cmd.DefineStoragePool.NumGroups = 2 - - pdisk_filter = cmd.DefineStoragePool.PDiskFilter.add() - pdisk_filter.Property.add().Type = 0 - pdisk_filter.Property.add().Kind = pdisk_user_kind + + pdisk_filter = cmd.DefineStoragePool.PDiskFilter.add() + pdisk_filter.Property.add().Type = 0 + pdisk_filter.Property.add().Kind = pdisk_user_kind self._bs_config_invoke(request) - return name + return name def __wait_for_bs_controller_to_start(self): monitors = [node.monitor for node in self.nodes.values()] |