Skip to content

Commit feaff80

Browse files
authored
Add node name prefix (#4356)
1 parent e4d1e0b commit feaff80

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

ydb/core/mind/node_broker.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ bool TNodeBroker::OnRenderAppHtmlPage(NMon::TEvRemoteHttpInfo::TPtr ev,
107107
<< " MaxStaticNodeId: " << AppData(ctx)->DynamicNameserviceConfig->MaxStaticNodeId << Endl
108108
<< " MaxDynamicNodeId: " << AppData(ctx)->DynamicNameserviceConfig->MaxDynamicNodeId << Endl
109109
<< " EpochDuration: " << EpochDuration << Endl
110+
<< " NodeNamePrefix: " << NodeNamePrefix << Endl
110111
<< " BannedIds:";
111112
for (auto &pr : BannedIds)
112113
str << " [" << pr.first << ", " << pr.second << "]";
@@ -346,7 +347,7 @@ void TNodeBroker::FillNodeName(const std::optional<ui32> &slotIndex,
346347
NKikimrNodeBroker::TNodeInfo &info) const
347348
{
348349
if (EnableDynamicNodeNameGeneration && slotIndex.has_value()) {
349-
const TString name = TStringBuilder() << "slot-" << slotIndex;
350+
const TString name = TStringBuilder() << NodeNamePrefix << slotIndex.value();
350351
info.SetName(name);
351352
}
352353
}
@@ -487,6 +488,8 @@ void TNodeBroker::LoadConfigFromProto(const NKikimrNodeBroker::TConfig &config)
487488
EpochDuration = MIN_LEASE_DURATION;
488489
}
489490

491+
NodeNamePrefix = config.GetNodeNamePrefix();
492+
490493
BannedIds.clear();
491494
for (auto &banned : config.GetBannedNodeIds())
492495
BannedIds.emplace_back(banned.GetFrom(), banned.GetTo());

ydb/core/mind/node_broker_impl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ class TNodeBroker : public TActor<TNodeBroker>
314314
TDuration EpochDuration;
315315
TVector<std::pair<ui32, ui32>> BannedIds;
316316
ui64 ConfigSubscriptionId;
317+
TString NodeNamePrefix;
317318

318319
// Events collected during initialization phase.
319320
TMultiMap<ui64, TEvNodeBroker::TEvListNodes::TPtr> DelayedListNodesRequests;
@@ -328,6 +329,7 @@ class TNodeBroker : public TActor<TNodeBroker>
328329
, TTabletExecutedFlat(info, tablet, new NMiniKQL::TMiniKQLFactory)
329330
, EpochDuration(TDuration::Hours(1))
330331
, ConfigSubscriptionId(0)
332+
, NodeNamePrefix("slot-")
331333
, TxProcessor(new TTxProcessor(*this, "root", NKikimrServices::NODE_BROKER))
332334
{
333335
}

ydb/core/protos/node_broker.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ message TConfig {
102102
optional uint64 EpochDuration = 1 [default = 3600000000];
103103
// Don't allocate and extend lease for IDs from banned intervals.
104104
repeated TNodeIds BannedNodeIds = 2;
105+
optional string NodeNamePrefix = 3 [default = "slot-"];
105106
}
106107

107108
message TGetConfigRequest {

0 commit comments

Comments
 (0)