Skip to content

Commit

Permalink
additional optimisations
Browse files Browse the repository at this point in the history
  • Loading branch information
vporyadke committed Oct 28, 2024
1 parent ce2617d commit 2595535
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
7 changes: 5 additions & 2 deletions ydb/core/mind/hive/leader_tablet_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,11 @@ TActorId TLeaderTabletInfo::SetLockedToActor(const TActorId& actor, const TDurat
}

void TLeaderTabletInfo::AcquireAllocationUnits() {
for (ui32 channel = 0; channel < TabletStorageInfo->Channels.size(); ++channel) {
AcquireAllocationUnit(channel);
for (const auto& channel : TabletStorageInfo->Channels) {
if (!channel.History.empty()) {
TStoragePoolInfo& storagePool = Hive.GetStoragePool(channel.StoragePool);
storagePool.AcquireAllocationUnit(this, channel.Channel, channel.History.back().GroupID);
}
}
}

Expand Down
3 changes: 1 addition & 2 deletions ydb/core/mind/hive/leader_tablet_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ struct TTabletCategoryInfo {
struct TStoragePoolInfo;

struct TLeaderTabletInfo : TTabletInfo {
protected:
public:
static TString DEFAULT_STORAGE_POOL_NAME;

public:
struct TChannel {
TTabletId TabletId;
ui32 ChannelId;
Expand Down
5 changes: 3 additions & 2 deletions ydb/core/mind/hive/storage_pool_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ TStoragePoolInfo::TStoragePoolInfo(const TString& name, THiveSharedSettings* hiv
}

TStorageGroupInfo& TStoragePoolInfo::GetStorageGroup(TStorageGroupId groupId) {
auto it = Groups.find(groupId);
decltype(Groups)::insert_ctx ctx;
auto it = Groups.find(groupId, ctx);
if (it == Groups.end()) {
it = Groups.emplace(std::piecewise_construct, std::tuple<TStorageGroupId>(groupId), std::tuple<const TStoragePoolInfo&, TStorageGroupId>(*this, groupId)).first;
it = Groups.emplace_direct(ctx, std::piecewise_construct, std::tuple<TStorageGroupId>(groupId), std::tuple<const TStoragePoolInfo&, TStorageGroupId>(*this, groupId));
}
return it->second;
}
Expand Down
3 changes: 3 additions & 0 deletions ydb/core/mind/hive/tx__load_everything.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,9 @@ class TTxLoadEverything : public TTransactionBase<THive> {
if (tablet) {
ui32 channelId = tabletChannelRowset.GetValue<Schema::TabletChannel::Channel>();
TString storagePool = tabletChannelRowset.GetValue<Schema::TabletChannel::StoragePool>();
if (storagePool.empty()) {
storagePool = TLeaderTabletInfo::DEFAULT_STORAGE_POOL_NAME;
}
Y_ABORT_UNLESS(tablet->BoundChannels.size() == channelId);
tablet->BoundChannels.emplace_back();
NKikimrStoragePool::TChannelBind& bind = tablet->BoundChannels.back();
Expand Down

0 comments on commit 2595535

Please sign in to comment.