Skip to content
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
1 change: 1 addition & 0 deletions ydb/core/base/appdata_fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ struct TAppData {
TVector<TString> DefaultUserSIDs;
TString AllAuthenticatedUsers = "all-users@well-known";
TString TenantName;
TString SlotName;

TIntrusivePtr<TResourceProfiles> ResourceProfiles;

Expand Down
4 changes: 4 additions & 0 deletions ydb/core/driver_lib/run/run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,10 @@ void TKikimrRunner::InitializeAppData(const TKikimrRunConfig& runConfig)

AppData->TenantName = runConfig.TenantName;

if (runConfig.AppConfig.GetDynamicNodeConfig().GetNodeInfo().HasSlotName()) {
AppData->SlotName = runConfig.AppConfig.GetDynamicNodeConfig().GetNodeInfo().GetSlotName();
}

if (runConfig.AppConfig.HasBootstrapConfig()) {
AppData->BootstrapConfig = runConfig.AppConfig.GetBootstrapConfig();
}
Expand Down
3 changes: 3 additions & 0 deletions ydb/core/mind/hive/hive_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1985,6 +1985,9 @@ void THive::Handle(TEvHive::TEvRequestHiveNodeStats::TPtr& ev) {
if (!node.ServicedDomains.empty()) {
nodeStats.MutableNodeDomain()->CopyFrom(node.ServicedDomains.front());
}
if (!node.SlotName.empty()) {
nodeStats.SetSlotName(node.SlotName);
}
if (request.GetReturnExtendedTabletInfo()) {
if (request.HasFilterTabletsByPathId()) {
auto itTabletsOfObject = node.TabletsOfObject.find({request.GetFilterTabletsBySchemeShardId(), request.GetFilterTabletsByPathId()});
Expand Down
3 changes: 2 additions & 1 deletion ydb/core/mind/hive/hive_schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,10 @@ struct Schema : NIceDb::Schema {
struct Drain : Column<6, NScheme::NTypeIds::Bool> { static constexpr bool Default = false; };
struct DrainInitiators : Column<8, NScheme::NTypeIds::String> { using Type = TVector<TActorId>; };
struct Location : Column<9, NScheme::NTypeIds::String> { using Type = NActorsInterconnect::TNodeLocation; };
struct Name : Column<10, NScheme::NTypeIds::String> {};

using TKey = TableKey<ID>;
using TColumns = TableColumns<ID, Local, Down, Freeze, ServicedDomains, Statistics, Drain, DrainInitiators, Location>;
using TColumns = TableColumns<ID, Local, Down, Freeze, ServicedDomains, Statistics, Drain, DrainInitiators, Location, Name>;
};

struct TabletCategory : Table<6> {
Expand Down
1 change: 1 addition & 0 deletions ydb/core/mind/hive/node_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ struct TNodeInfo {
mutable TInstant LastResourceChangeReaction;
NKikimrHive::TNodeStatistics Statistics;
bool DeletionScheduled = false;
TString SlotName;

TNodeInfo(TNodeId nodeId, THive& hive);
TNodeInfo(const TNodeInfo&) = delete;
Expand Down
1 change: 1 addition & 0 deletions ydb/core/mind/hive/tx__load_everything.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ class TTxLoadEverything : public TTransactionBase<THive> {
node.DrainInitiators = nodeRowset.GetValueOrDefault<Schema::Node::DrainInitiators>();
node.ServicedDomains = nodeRowset.GetValueOrDefault<Schema::Node::ServicedDomains>();
node.Statistics = nodeRowset.GetValueOrDefault<Schema::Node::Statistics>();
node.SlotName = nodeRowset.GetValueOrDefault<Schema::Node::Name>();
if (nodeRowset.HaveValue<Schema::Node::Location>()) {
auto location = nodeRowset.GetValue<Schema::Node::Location>();
if (location.HasDataCenter()) {
Expand Down
10 changes: 9 additions & 1 deletion ydb/core/mind/hive/tx__register_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@ class TTxRegisterNode : public TTransactionBase<THive> {
} else {
Sort(servicedDomains);
}
db.Table<Schema::Node>().Key(nodeId).Update<Schema::Node::Local, Schema::Node::ServicedDomains, Schema::Node::Statistics>(Local, servicedDomains, node.Statistics);
const TString& slotName = Record.GetSlotName();
db.Table<Schema::Node>().Key(nodeId).Update(
NIceDb::TUpdate<Schema::Node::Local>(Local),
NIceDb::TUpdate<Schema::Node::ServicedDomains>(servicedDomains),
NIceDb::TUpdate<Schema::Node::Statistics>(node.Statistics),
NIceDb::TUpdate<Schema::Node::Name>(slotName)
);

node.BecomeDisconnected();
if (node.LastSeenServicedDomains != servicedDomains) {
// new tenant - new rules
Expand All @@ -52,6 +59,7 @@ class TTxRegisterNode : public TTransactionBase<THive> {
node.Local = Local;
node.ServicedDomains.swap(servicedDomains);
node.LastSeenServicedDomains = node.ServicedDomains;
node.SlotName = slotName;
}
if (Record.HasSystemLocation() && Record.GetSystemLocation().HasDataCenter()) {
node.Location = TNodeLocation(Record.GetSystemLocation());
Expand Down
3 changes: 3 additions & 0 deletions ydb/core/mind/local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ class TLocalNodeRegistrar : public TActorBootstrapped<TLocalNodeRegistrar> {
}
tabletAvailability->SetPriority(tabletInfo.Priority);
}
if (const TString& slotName = AppData(ctx)->SlotName; !slotName.Empty()) {
request->Record.SetSlotName(slotName);
}

NTabletPipe::SendData(ctx, HivePipeClient, request.Release());

Expand Down
1 change: 1 addition & 0 deletions ydb/core/protos/hive.proto
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ message THiveNodeStats {
optional uint32 RestartsPerPeriod = 6;
optional uint64 LastAliveTimestamp = 7;
optional NKikimrSubDomains.TDomainKey NodeDomain = 8;
optional string SlotName = 9;
}

message TEvResponseHiveNodeStats {
Expand Down
1 change: 1 addition & 0 deletions ydb/core/protos/local.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ message TEvRegisterNode {
repeated NKikimrSubDomains.TDomainKey ServicedDomains = 2;
optional NActorsInterconnect.TNodeLocation SystemLocation = 3;
repeated TTabletAvailability TabletAvailability = 4;
optional string SlotName = 5;
}

message TEvRegisterNodeResult {
Expand Down
1 change: 1 addition & 0 deletions ydb/core/protos/node_whiteboard.proto
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ message TSystemStateInfo {
optional uint64 DisconnectTime = 34;
optional TNodeSharedCache SharedCacheStats = 35;
optional uint32 TotalSessions = 36;
optional string SlotName = 37;
}

message TEvSystemStateRequest {
Expand Down
3 changes: 3 additions & 0 deletions ydb/core/tablet/node_whiteboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ class TNodeWhiteboardService : public TActorBootstrapped<TNodeWhiteboardService>
TabletIntrospectionData.Reset(NTracing::CreateTraceCollection(introspectionGroup));

SystemStateInfo.SetHost(FQDNHostName());
if (const TString& slotName = AppData(ctx)->SlotName; !slotName.Empty()) {
SystemStateInfo.SetSlotName(slotName);
}
SystemStateInfo.SetNumberOfCpus(NSystemInfo::NumberOfCpus());
auto version = GetProgramRevision();
if (!version.empty()) {
Expand Down
8 changes: 8 additions & 0 deletions ydb/core/viewer/json_nodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class TJsonNodes : public TViewerPipeClient<TJsonNodes> {
std::unique_ptr<TEvBlobStorage::TEvControllerConfigResponse> BaseConfig;
std::unordered_map<ui32, const NKikimrBlobStorage::TBaseConfig::TGroup*> BaseConfigGroupIndex;
std::unordered_map<TNodeId, ui64> DisconnectTime;
std::unordered_map<TNodeId, TString> NodeSlotName;
TJsonSettings JsonSettings;
ui32 Timeout = 0;
TString FilterTenant;
Expand Down Expand Up @@ -481,6 +482,9 @@ class TJsonNodes : public TViewerPipeClient<TJsonNodes> {
BLOG_TRACE("HiveNodeStats filter node by " << nodeId);
FilterNodeIds.insert(nodeId);
DisconnectTime[nodeId] = nodeStats.GetLastAliveTimestamp();
if (nodeStats.HasSlotName()) {
NodeSlotName[nodeId] = nodeStats.GetSlotName();
}
}
if (--RequestsBeforeNodeList == 0) {
ProcessNodeIds();
Expand Down Expand Up @@ -752,6 +756,10 @@ class TJsonNodes : public TViewerPipeClient<TJsonNodes> {
if (itDisconnectTime != DisconnectTime.end()) {
nodeInfo.MutableSystemState()->SetDisconnectTime(itDisconnectTime->second);
}
auto itNodeSlotName = NodeSlotName.find(nodeId);
if (itNodeSlotName != NodeSlotName.end()) {
nodeInfo.MutableSystemState()->SetSlotName(itNodeSlotName->second);
}
}
if (Storage) {
auto itPDiskState = PDiskInfo.find(nodeId);
Expand Down