Skip to content

Add node name prefix #4356

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

Merged
merged 2 commits into from
May 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
5 changes: 4 additions & 1 deletion ydb/core/mind/node_broker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ bool TNodeBroker::OnRenderAppHtmlPage(NMon::TEvRemoteHttpInfo::TPtr ev,
<< " MaxStaticNodeId: " << AppData(ctx)->DynamicNameserviceConfig->MaxStaticNodeId << Endl
<< " MaxDynamicNodeId: " << AppData(ctx)->DynamicNameserviceConfig->MaxDynamicNodeId << Endl
<< " EpochDuration: " << EpochDuration << Endl
<< " NodeNamePrefix: " << NodeNamePrefix << Endl
<< " BannedIds:";
for (auto &pr : BannedIds)
str << " [" << pr.first << ", " << pr.second << "]";
Expand Down Expand Up @@ -346,7 +347,7 @@ void TNodeBroker::FillNodeName(const std::optional<ui32> &slotIndex,
NKikimrNodeBroker::TNodeInfo &info) const
{
if (EnableDynamicNodeNameGeneration && slotIndex.has_value()) {
const TString name = TStringBuilder() << "slot-" << slotIndex;
const TString name = TStringBuilder() << NodeNamePrefix << slotIndex.value();
info.SetName(name);
}
}
Expand Down Expand Up @@ -487,6 +488,8 @@ void TNodeBroker::LoadConfigFromProto(const NKikimrNodeBroker::TConfig &config)
EpochDuration = MIN_LEASE_DURATION;
}

NodeNamePrefix = config.GetNodeNamePrefix();

BannedIds.clear();
for (auto &banned : config.GetBannedNodeIds())
BannedIds.emplace_back(banned.GetFrom(), banned.GetTo());
Expand Down
2 changes: 2 additions & 0 deletions ydb/core/mind/node_broker_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ class TNodeBroker : public TActor<TNodeBroker>
TDuration EpochDuration;
TVector<std::pair<ui32, ui32>> BannedIds;
ui64 ConfigSubscriptionId;
TString NodeNamePrefix;

// Events collected during initialization phase.
TMultiMap<ui64, TEvNodeBroker::TEvListNodes::TPtr> DelayedListNodesRequests;
Expand All @@ -328,6 +329,7 @@ class TNodeBroker : public TActor<TNodeBroker>
, TTabletExecutedFlat(info, tablet, new NMiniKQL::TMiniKQLFactory)
, EpochDuration(TDuration::Hours(1))
, ConfigSubscriptionId(0)
, NodeNamePrefix("slot-")
, TxProcessor(new TTxProcessor(*this, "root", NKikimrServices::NODE_BROKER))
{
}
Expand Down
1 change: 1 addition & 0 deletions ydb/core/protos/node_broker.proto
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ message TConfig {
optional uint64 EpochDuration = 1 [default = 3600000000];
// Don't allocate and extend lease for IDs from banned intervals.
repeated TNodeIds BannedNodeIds = 2;
optional string NodeNamePrefix = 3 [default = "slot-"];
}

message TGetConfigRequest {
Expand Down