diff --git a/ydb/core/mind/local.cpp b/ydb/core/mind/local.cpp index c2e1883f45a9..07d4fc59ec34 100644 --- a/ydb/core/mind/local.cpp +++ b/ydb/core/mind/local.cpp @@ -1117,7 +1117,6 @@ class TDomainLocal : public TActorBootstrapped { info.Attributes.emplace(std::make_pair(attr.GetKey(), attr.GetValue())); RunningTenants.emplace(std::make_pair(task.Info.TenantName, info)); const TActorId whiteboardServiceId(NNodeWhiteboard::MakeNodeWhiteboardServiceId(SelfId().NodeId())); - Send(whiteboardServiceId, new NNodeWhiteboard::TEvWhiteboard::TEvSystemStateAddRole("Tenant")); Send(whiteboardServiceId, new NNodeWhiteboard::TEvWhiteboard::TEvSystemStateSetTenant(task.Info.TenantName)); for (TTabletId hId : hiveIds) { LOG_DEBUG_S(ctx, NKikimrServices::LOCAL, diff --git a/ydb/core/tablet/node_whiteboard.cpp b/ydb/core/tablet/node_whiteboard.cpp index 4bd4adad855e..6bac6df9394a 100644 --- a/ydb/core/tablet/node_whiteboard.cpp +++ b/ydb/core/tablet/node_whiteboard.cpp @@ -53,12 +53,6 @@ class TNodeWhiteboardService : public TActorBootstrapped *versionCounter->GetCounter("version", false) = 1; } - // TODO(t1mursadykov): Add role for static nodes with sys tablets only - if (AppData(ctx)->DynamicNameserviceConfig) { - if (SelfId().NodeId() <= AppData(ctx)->DynamicNameserviceConfig->MaxStaticNodeId) - ctx.Send(ctx.SelfID, new TEvWhiteboard::TEvSystemStateAddRole("Storage")); - } - SystemStateInfo.SetStartTime(ctx.Now().MilliSeconds()); ProcessStats.Fill(getpid()); if (ProcessStats.CGroupMemLim != 0) { @@ -385,6 +379,16 @@ class TNodeWhiteboardService : public TActorBootstrapped return modified; } + void SetRole(TStringBuf roleName) { + for (const auto& role : SystemStateInfo.GetRoles()) { + if (role == roleName) { + return; + } + } + SystemStateInfo.AddRoles(TString(roleName)); + SystemStateInfo.SetChangeTime(TActivationContext::Now().MilliSeconds()); + } + STRICT_STFUNC(StateFunc, HFunc(TEvWhiteboard::TEvTabletStateUpdate, Handle); HFunc(TEvWhiteboard::TEvTabletStateRequest, Handle); @@ -458,6 +462,7 @@ class TNodeWhiteboardService : public TActorBootstrapped if (CheckedMerge(pDiskStateInfo, ev->Get()->Record) >= 100) { pDiskStateInfo.SetChangeTime(ctx.Now().MilliSeconds()); } + SetRole("Storage"); } void Handle(TEvWhiteboard::TEvVDiskStateUpdate::TPtr &ev, const TActorContext &ctx) { @@ -560,6 +565,7 @@ class TNodeWhiteboardService : public TActorBootstrapped SystemStateInfo.ClearTenants(); SystemStateInfo.AddTenants(ev->Get()->Tenant); SystemStateInfo.SetChangeTime(ctx.Now().MilliSeconds()); + SetRole("Tenant"); } }