Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NBS-4918 : Add possibility to use entityId. #604

Merged
merged 3 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cloud/blockstore/libs/daemon/ydb/config_initializer_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ Y_UNIT_TEST_SUITE(TConfigInitializerTest)
UNIT_ASSERT_VALUES_EQUAL(true, !!ci.StorageConfig);
UNIT_ASSERT_VALUES_EQUAL(true, ci.StorageConfig->IsBalancerFeatureEnabled(
"yc.disk-manager.cloud",
"yc.disk-manager.folder"));
"yc.disk-manager.folder",
""));
UNIT_ASSERT_VALUES_EQUAL(true, ci.StorageConfig->GetMultipartitionVolumesEnabled());
}

Expand Down Expand Up @@ -116,7 +117,8 @@ Y_UNIT_TEST_SUITE(TConfigInitializerTest)
UNIT_ASSERT_VALUES_EQUAL(true, !!ci.StorageConfig);
UNIT_ASSERT_VALUES_EQUAL(true, ci.StorageConfig->IsBalancerFeatureEnabled(
"yc.disk-manager.cloud",
"yc.disk-manager.folder"));
"yc.disk-manager.folder",
""));
UNIT_ASSERT_VALUES_EQUAL(true, ci.StorageConfig->GetMultipartitionVolumesEnabled());
}

Expand Down
6 changes: 4 additions & 2 deletions cloud/blockstore/libs/disk_agent/config_initializer_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ Y_UNIT_TEST_SUITE(TConfigInitializerTest)
UNIT_ASSERT_VALUES_EQUAL(true, !!ci.StorageConfig);
UNIT_ASSERT_VALUES_EQUAL(true, ci.StorageConfig->IsBalancerFeatureEnabled(
"yc.disk-manager.cloud",
"yc.disk-manager.folder"));
"yc.disk-manager.folder",
""));
UNIT_ASSERT_VALUES_EQUAL(true, ci.StorageConfig->GetMultipartitionVolumesEnabled());
}

Expand Down Expand Up @@ -110,7 +111,8 @@ Y_UNIT_TEST_SUITE(TConfigInitializerTest)
UNIT_ASSERT_VALUES_EQUAL(true, !!ci.StorageConfig);
UNIT_ASSERT_VALUES_EQUAL(true, ci.StorageConfig->IsBalancerFeatureEnabled(
"yc.disk-manager.cloud",
"yc.disk-manager.folder"));
"yc.disk-manager.folder",
""));
UNIT_ASSERT_VALUES_EQUAL(true, ci.StorageConfig->GetMultipartitionVolumesEnabled());
}
}
Expand Down
29 changes: 22 additions & 7 deletions cloud/blockstore/libs/storage/core/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ TDuration MSeconds(ui32 value)
\
xxx(TenantHiveTabletId, ui64, 0 )\
\
xxx(MaxChangedBlocksRangeBlocksCount, ui64, 1 << 20 )\
xxx(MaxChangedBlocksRangeBlocksCount, ui64, 1 << 20 )\
// BLOCKSTORE_STORAGE_CONFIG_RO

#define BLOCKSTORE_STORAGE_CONFIG_RW(xxx) \
Expand Down Expand Up @@ -745,9 +745,14 @@ void TStorageConfig::DumpHtml(IOutputStream& out) const
#define BLOCKSTORE_BINARY_FEATURE_GETTER(name) \
bool TStorageConfig::Is##name##FeatureEnabled( \
const TString& cloudId, \
const TString& folderId) const \
const TString& folderId, \
const TString& diskId) const \
{ \
return Impl->FeaturesConfig->IsFeatureEnabled(cloudId, folderId, #name); \
return Impl->FeaturesConfig->IsFeatureEnabled( \
cloudId, \
folderId, \
diskId, \
#name); \
} \

// BLOCKSTORE_BINARY_FEATURE_GETTER
Expand All @@ -759,9 +764,14 @@ bool TStorageConfig::Is##name##FeatureEnabled( \
#define BLOCKSTORE_DURATION_FEATURE_GETTER(name) \
TDuration TStorageConfig::Get##name##FeatureValue( \
const TString& cloudId, \
const TString& folderId) const \
const TString& folderId, \
const TString& diskId) const \
{ \
auto v = Impl->FeaturesConfig->GetFeatureValue(cloudId, folderId, #name); \
const auto v = Impl->FeaturesConfig->GetFeatureValue( \
cloudId, \
folderId, \
diskId, \
#name); \
if (v) { \
return TDuration::Parse(v); \
} \
Expand All @@ -778,9 +788,14 @@ TDuration TStorageConfig::Get##name##FeatureValue( \
#define BLOCKSTORE_STRING_FEATURE_GETTER(name) \
TString TStorageConfig::Get##name##FeatureValue( \
const TString& cloudId, \
const TString& folderId) const \
const TString& folderId, \
const TString& diskId) const \
{ \
return Impl->FeaturesConfig->GetFeatureValue(cloudId, folderId, #name); \
return Impl->FeaturesConfig->GetFeatureValue( \
cloudId, \
folderId, \
diskId, \
#name); \
} \

// BLOCKSTORE_STRING_FEATURE_GETTER
Expand Down
51 changes: 34 additions & 17 deletions cloud/blockstore/libs/storage/core/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,57 +302,74 @@ class TStorageConfig

bool IsBalancerFeatureEnabled(
const TString& cloudId,
const TString& folderId) const;
const TString& folderId,
const TString& diskId) const;
bool IsIncrementalCompactionFeatureEnabled(
const TString& cloudId,
const TString& folderId) const;
const TString& folderId,
const TString& diskId) const;
bool IsMultipartitionVolumesFeatureEnabled(
const TString& cloudId,
const TString& folderId) const;
const TString& folderId,
const TString& diskId) const;
bool IsAllocateFreshChannelFeatureEnabled(
const TString& cloudId,
const TString& folderId) const;
const TString& folderId,
const TString& diskId) const;
bool IsFreshChannelWriteRequestsFeatureEnabled(
const TString& cloudId,
const TString& folderId) const;
const TString& folderId,
const TString& diskId) const;
bool IsMixedIndexCacheV1FeatureEnabled(
const TString& cloudId,
const TString& folderId) const;
const TString& folderId,
const TString& diskId) const;
bool IsBatchCompactionFeatureEnabled(
const TString& cloudId,
const TString& folderId) const;
const TString& folderId,
const TString& diskId) const;
bool IsBlobPatchingFeatureEnabled(
const TString& cloudId,
const TString& folderId) const;
const TString& folderId,
const TString& diskId) const;
bool IsUseRdmaFeatureEnabled(
const TString& cloudId,
const TString& folderId) const;
const TString& folderId,
const TString& diskId) const;
bool IsChangeThrottlingPolicyFeatureEnabled(
const TString& cloudId,
const TString& folderId) const;
const TString& folderId,
const TString& diskId) const;
bool IsReplaceDeviceFeatureEnabled(
const TString& cloudId,
const TString& folderId) const;
const TString& folderId,
const TString& diskId) const;
bool IsUseNonReplicatedHDDInsteadOfReplicatedFeatureEnabled(
const TString& cloudId,
const TString& folderId) const;
const TString& folderId,
const TString& diskId) const;

TDuration GetMaxTimedOutDeviceStateDurationFeatureValue(
const TString& cloudId,
const TString& folderId) const;
const TString& folderId,
const TString& diskId) const;

TString GetSSDSystemChannelPoolKindFeatureValue(
const TString& cloudId,
const TString& folderId) const;
const TString& folderId,
const TString& diskId) const;
TString GetSSDLogChannelPoolKindFeatureValue(
const TString& cloudId,
const TString& folderId) const;
const TString& folderId,
const TString& diskId) const;
TString GetSSDIndexChannelPoolKindFeatureValue(
const TString& cloudId,
const TString& folderId) const;
const TString& folderId,
const TString& diskId) const;
TString GetSSDFreshChannelPoolKindFeatureValue(
const TString& cloudId,
const TString& folderId) const;
const TString& folderId,
const TString& diskId) const;

ui32 GetDefaultTabletVersion() const;

Expand Down
27 changes: 18 additions & 9 deletions cloud/blockstore/libs/storage/core/volume_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ TPoolKinds GetPoolKinds(
const TStorageConfig& config,
const NCloud::NProto::EStorageMediaKind mediaKind,
const TString& cloudId,
const TString& folderId)
const TString& folderId,
const TString& diskId)
{
switch (mediaKind) {
case NCloud::NProto::STORAGE_MEDIA_HDD: {
Expand All @@ -230,24 +231,25 @@ TPoolKinds GetPoolKinds(
case NCloud::NProto::STORAGE_MEDIA_SSD: {
auto systemChannelPoolKind =
config.GetSSDSystemChannelPoolKindFeatureValue(
cloudId, folderId);
cloudId, folderId, diskId);
if (systemChannelPoolKind.Empty()) {
systemChannelPoolKind = config.GetSSDSystemChannelPoolKind();
}
auto logChannelPoolKind =
config.GetSSDLogChannelPoolKindFeatureValue(cloudId, folderId);
config.GetSSDLogChannelPoolKindFeatureValue(
cloudId, folderId, diskId);
if (logChannelPoolKind.Empty()) {
logChannelPoolKind = config.GetSSDLogChannelPoolKind();
}
auto indexChannelPoolKind =
config.GetSSDIndexChannelPoolKindFeatureValue(
cloudId, folderId);
cloudId, folderId, diskId);
if (indexChannelPoolKind.Empty()) {
indexChannelPoolKind = config.GetSSDIndexChannelPoolKind();
}
auto freshChannelPoolKind =
config.GetSSDFreshChannelPoolKindFeatureValue(
cloudId, folderId);
cloudId, folderId, diskId);
if (freshChannelPoolKind.Empty()) {
freshChannelPoolKind = config.GetSSDFreshChannelPoolKind();
}
Expand Down Expand Up @@ -287,7 +289,11 @@ void SetExplicitChannelProfiles(
{
const auto unit = GetAllocationUnit(config, mediaKind);
const auto poolKinds = GetPoolKinds(
config, mediaKind, volumeConfig.GetCloudId(), volumeConfig.GetFolderId());
config,
mediaKind,
volumeConfig.GetCloudId(),
volumeConfig.GetFolderId(),
volumeConfig.GetDiskId());
const ui64 freshChannelSize = 128_MB;

AddOrModifyChannel(
Expand Down Expand Up @@ -412,7 +418,8 @@ void SetVolumeExplicitChannelProfiles(
config,
NCloud::NProto::STORAGE_MEDIA_SSD,
volumeConfig.GetCloudId(),
volumeConfig.GetFolderId());
volumeConfig.GetFolderId(),
volumeConfig.GetDiskId());

SetupVolumeChannel(
poolKinds.System,
Expand Down Expand Up @@ -511,7 +518,8 @@ void SetupChannels(
const bool isFreshChannelEnabled =
config.IsAllocateFreshChannelFeatureEnabled(
volumeConfig.GetCloudId(),
volumeConfig.GetFolderId());
volumeConfig.GetFolderId(),
volumeConfig.GetDiskId());

if (isFreshChannelEnabled || volumeConfig.GetTabletVersion() == 2) {
freshChannelCount = 1;
Expand Down Expand Up @@ -575,6 +583,7 @@ TPartitionsInfo ComputePartitionsInfo(
const TStorageConfig& config,
const TString& cloudId,
const TString& folderId,
const TString& diskId,
NCloud::NProto::EStorageMediaKind mediaKind,
ui64 blocksCount,
ui32 blockSize,
Expand All @@ -584,7 +593,7 @@ TPartitionsInfo ComputePartitionsInfo(
TPartitionsInfo info;

const bool enabledForCloud =
config.IsMultipartitionVolumesFeatureEnabled(cloudId, folderId);
config.IsMultipartitionVolumesFeatureEnabled(cloudId, folderId, diskId);
const ui64 bytesPerPartition = mediaKind == NCloud::NProto::STORAGE_MEDIA_SSD
? config.GetBytesPerPartitionSSD() : config.GetBytesPerPartition();
const bool enabled = (enabledForCloud
Expand Down
1 change: 1 addition & 0 deletions cloud/blockstore/libs/storage/core/volume_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ TPartitionsInfo ComputePartitionsInfo(
const TStorageConfig& config,
const TString& cloudId,
const TString& folderId,
const TString& diskId,
NCloud::NProto::EStorageMediaKind mediaKind,
ui64 blocksCount,
ui32 blockSize,
Expand Down
12 changes: 12 additions & 0 deletions cloud/blockstore/libs/storage/core/volume_model_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1651,6 +1651,7 @@ Y_UNIT_TEST_SUITE(TVolumeModelTest)
*config,
"cloud_id",
"folder_id",
"disk_id",
NCloud::NProto::STORAGE_MEDIA_HYBRID,
100500,
33,
Expand Down Expand Up @@ -1680,6 +1681,7 @@ Y_UNIT_TEST_SUITE(TVolumeModelTest)
*config,
"cloud_id",
"folder_id",
"disk_id",
NCloud::NProto::STORAGE_MEDIA_HYBRID,
blocksCount,
4_KB,
Expand All @@ -1695,6 +1697,7 @@ Y_UNIT_TEST_SUITE(TVolumeModelTest)
*config,
"cloud_id",
"folder_id",
"disk_id",
NCloud::NProto::STORAGE_MEDIA_HYBRID,
blocksCount,
4_KB,
Expand All @@ -1710,6 +1713,7 @@ Y_UNIT_TEST_SUITE(TVolumeModelTest)
*config,
"cloud_id",
"folder_id",
"disk_id",
NCloud::NProto::STORAGE_MEDIA_SSD,
blocksCount,
4_KB,
Expand All @@ -1725,6 +1729,7 @@ Y_UNIT_TEST_SUITE(TVolumeModelTest)
*config,
"cloud_id",
"folder_id",
"disk_id",
NCloud::NProto::STORAGE_MEDIA_HYBRID,
blocksCount,
4_KB,
Expand All @@ -1743,6 +1748,7 @@ Y_UNIT_TEST_SUITE(TVolumeModelTest)
*config,
"cloud_id",
"folder_id",
"disk_id",
NCloud::NProto::STORAGE_MEDIA_HYBRID,
blocksCount,
4_KB,
Expand All @@ -1761,6 +1767,7 @@ Y_UNIT_TEST_SUITE(TVolumeModelTest)
*config,
"cloud_id",
"folder_id",
"disk_id",
NCloud::NProto::STORAGE_MEDIA_HYBRID,
blocksCount,
64_KB,
Expand All @@ -1779,6 +1786,7 @@ Y_UNIT_TEST_SUITE(TVolumeModelTest)
*config,
"cloud_id",
"folder_id",
"disk_id",
NCloud::NProto::STORAGE_MEDIA_HYBRID,
blocksCount,
64_KB,
Expand Down Expand Up @@ -1811,6 +1819,7 @@ Y_UNIT_TEST_SUITE(TVolumeModelTest)
*config,
"cloud_id",
"folder_id",
"disk_id",
NCloud::NProto::STORAGE_MEDIA_HYBRID,
blocksCount,
4_KB,
Expand Down Expand Up @@ -1849,6 +1858,7 @@ Y_UNIT_TEST_SUITE(TVolumeModelTest)
*config,
"cloud_id",
"folder_id",
"disk_id",
NCloud::NProto::STORAGE_MEDIA_SSD,
blocksCount,
4_KB,
Expand All @@ -1863,6 +1873,7 @@ Y_UNIT_TEST_SUITE(TVolumeModelTest)
*config,
"cloud_id",
"folder_id",
"disk_id",
NCloud::NProto::STORAGE_MEDIA_SSD,
blocksCount,
4_KB,
Expand All @@ -1877,6 +1888,7 @@ Y_UNIT_TEST_SUITE(TVolumeModelTest)
*config,
"cloud_id",
"folder_id",
"disk_id",
NCloud::NProto::STORAGE_MEDIA_SSD,
blocksCount,
4_KB,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,8 @@ void TDiskRegistryActor::RenderDiskHtmlInfo(

const bool replaceDeviceAllowed = Config->IsReplaceDeviceFeatureEnabled(
info.CloudId,
info.FolderId);
info.FolderId,
info.MasterDiskId ? info.MasterDiskId : id);

TAG(TH3) {
out << "Disk " << id.Quote();
Expand Down
Loading