Skip to content

Commit 99558f2

Browse files
authored
Merge fe2772c into 20c3a09
2 parents 20c3a09 + fe2772c commit 99558f2

30 files changed

+631
-30
lines changed

ydb/core/base/appdata_fwd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ struct TAppData {
240240
TVector<TString> DefaultUserSIDs;
241241
TString AllAuthenticatedUsers = "all-users@well-known";
242242
TString TenantName;
243+
TString NodeName;
243244

244245
TIntrusivePtr<TResourceProfiles> ResourceProfiles;
245246

ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,23 @@ class TClientCommandServerBase : public TClientCommand {
722722
TRACE_CONFIG_CHANGE_INPLACE_T(TenantPoolConfig, UpdateExplicitly);
723723
}
724724

725-
if (config.ParseResult->Has("tenant") && InterconnectPort != DefaultInterconnectPort) {
726-
AppConfig.MutableMonitoringConfig()->SetHostLabelOverride(HostAndICPort());
725+
if (config.ParseResult->Has("tenant")) {
726+
if (AppConfig.GetDynamicNodeConfig().GetNodeInfo().HasName()) {
727+
const TString& nodeName = AppConfig.GetDynamicNodeConfig().GetNodeInfo().GetName();
728+
AppConfig.MutableMonitoringConfig()->SetHostLabelOverride(nodeName);
729+
TRACE_CONFIG_CHANGE_INPLACE_T(MonitoringConfig, UpdateExplicitly);
730+
} else if (InterconnectPort != DefaultInterconnectPort) {
731+
AppConfig.MutableMonitoringConfig()->SetHostLabelOverride(HostAndICPort());
732+
TRACE_CONFIG_CHANGE_INPLACE_T(MonitoringConfig, UpdateExplicitly);
733+
}
734+
}
735+
736+
if (config.ParseResult->Has("tenant")) {
737+
if (InterconnectPort == DefaultInterconnectPort) {
738+
AppConfig.MutableMonitoringConfig()->SetProcessLocation(Host());
739+
} else {
740+
AppConfig.MutableMonitoringConfig()->SetProcessLocation(HostAndICPort());
741+
}
727742
TRACE_CONFIG_CHANGE_INPLACE_T(MonitoringConfig, UpdateExplicitly);
728743
}
729744

@@ -989,11 +1004,18 @@ class TClientCommandServerBase : public TClientCommand {
9891004
ShuffleRange(addrs);
9901005
}
9911006

992-
TString HostAndICPort() {
1007+
TString HostAndICPort() const {
1008+
auto hostname = Host();
1009+
if (!hostname) {
1010+
return "";
1011+
}
1012+
return TStringBuilder() << hostname << ":" << InterconnectPort;
1013+
}
1014+
1015+
TString Host() const {
9931016
try {
9941017
auto hostname = to_lower(HostName());
995-
hostname = hostname.substr(0, hostname.find('.'));
996-
return TStringBuilder() << hostname << ":" << InterconnectPort;
1018+
return hostname.substr(0, hostname.find('.'));
9971019
} catch (TSystemError& error) {
9981020
return "";
9991021
}
@@ -1015,6 +1037,11 @@ class TClientCommandServerBase : public TClientCommand {
10151037
result = TryToRegisterDynamicNodeViaDiscoveryService(addr, domainName, NodeHost, NodeAddress, NodeResolveHost, GetSchemePath());
10161038
if (result.IsSuccess()) {
10171039
Cout << "Success. Registered via discovery service as " << result.GetNodeId() << Endl;
1040+
Cout << "Node name: ";
1041+
if (result.HasNodeName()) {
1042+
Cout << result.GetNodeName();
1043+
}
1044+
Cout << Endl;
10181045
break;
10191046
}
10201047
Cerr << "Registration error: " << static_cast<NYdb::TStatus>(result) << Endl;
@@ -1052,6 +1079,9 @@ class TClientCommandServerBase : public TClientCommand {
10521079
nodeInfo->SetAddress(node.Address);
10531080
nodeInfo->SetExpire(node.Expire);
10541081
CopyNodeLocation(nodeInfo->MutableLocation(), node.Location);
1082+
if (result.HasNodeName()) {
1083+
nodeInfo->SetName(result.GetNodeName());
1084+
}
10551085
} else {
10561086
auto &info = *nsConfig.AddNode();
10571087
info.SetNodeId(node.NodeId);

ydb/core/driver_lib/run/kikimr_services_initializers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2106,7 +2106,7 @@ void TKqpServiceInitializer::InitializeServices(NActors::TActorSystemSetup* setu
21062106

21072107
auto kqpProxySharedResources = std::make_shared<NKqp::TKqpProxySharedResources>();
21082108

2109-
// Crate resource manager
2109+
// Create resource manager
21102110
auto rm = NKqp::CreateKqpResourceManagerActor(Config.GetTableServiceConfig().GetResourceManager(), nullptr,
21112111
{}, kqpProxySharedResources);
21122112
setup->LocalServices.push_back(std::make_pair(

ydb/core/driver_lib/run/run.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,10 @@ void TKikimrRunner::InitializeAppData(const TKikimrRunConfig& runConfig)
10751075

10761076
AppData->TenantName = runConfig.TenantName;
10771077

1078+
if (runConfig.AppConfig.GetDynamicNodeConfig().GetNodeInfo().HasName()) {
1079+
AppData->NodeName = runConfig.AppConfig.GetDynamicNodeConfig().GetNodeInfo().GetName();
1080+
}
1081+
10781082
if (runConfig.AppConfig.HasBootstrapConfig()) {
10791083
AppData->BootstrapConfig = runConfig.AppConfig.GetBootstrapConfig();
10801084
}

ydb/core/grpc_services/rpc_node_registration.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ class TNodeRegistrationRPC : public TActorBootstrapped<TNodeRegistrationRPC> {
106106

107107
auto request = TEvNodeRegistrationRequest::GetProtoRequest(Request);
108108
Result.set_node_id(rec.GetNode().GetNodeId());
109+
if (rec.GetNode().HasName()) {
110+
Result.set_node_name(rec.GetNode().GetName());
111+
}
109112
Result.set_expire(rec.GetNode().GetExpire());
110113
Result.set_domain_path(request->domain_path());
111114
CopyNodeInfo(Result.add_nodes(), rec.GetNode());

ydb/core/mind/hive/hive_impl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,6 +1974,9 @@ void THive::Handle(TEvHive::TEvRequestHiveNodeStats::TPtr& ev) {
19741974
if (!node.ServicedDomains.empty()) {
19751975
nodeStats.MutableNodeDomain()->CopyFrom(node.ServicedDomains.front());
19761976
}
1977+
if (!node.Name.empty()) {
1978+
nodeStats.SetNodeName(node.Name);
1979+
}
19771980
if (request.GetReturnExtendedTabletInfo()) {
19781981
if (request.HasFilterTabletsByPathId()) {
19791982
auto itTabletsOfObject = node.TabletsOfObject.find({request.GetFilterTabletsBySchemeShardId(), request.GetFilterTabletsByPathId()});

ydb/core/mind/hive/hive_schema.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,10 @@ struct Schema : NIceDb::Schema {
192192
struct Drain : Column<6, NScheme::NTypeIds::Bool> { static constexpr bool Default = false; };
193193
struct DrainInitiators : Column<8, NScheme::NTypeIds::String> { using Type = TVector<TActorId>; };
194194
struct Location : Column<9, NScheme::NTypeIds::String> { using Type = NActorsInterconnect::TNodeLocation; };
195+
struct Name : Column<10, NScheme::NTypeIds::String> {};
195196

196197
using TKey = TableKey<ID>;
197-
using TColumns = TableColumns<ID, Local, Down, Freeze, ServicedDomains, Statistics, Drain, DrainInitiators, Location>;
198+
using TColumns = TableColumns<ID, Local, Down, Freeze, ServicedDomains, Statistics, Drain, DrainInitiators, Location, Name>;
198199
};
199200

200201
struct TabletCategory : Table<6> {

ydb/core/mind/hive/node_info.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ struct TNodeInfo {
6060
THashSet<TLeaderTabletInfo*> LockedTablets;
6161
mutable TInstant LastResourceChangeReaction;
6262
NKikimrHive::TNodeStatistics Statistics;
63+
TString Name;
6364

6465
TNodeInfo(TNodeId nodeId, THive& hive);
6566
TNodeInfo(const TNodeInfo&) = delete;

ydb/core/mind/hive/tx__load_everything.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ class TTxLoadEverything : public TTransactionBase<THive> {
314314
node.DrainInitiators = nodeRowset.GetValueOrDefault<Schema::Node::DrainInitiators>();
315315
node.ServicedDomains = nodeRowset.GetValueOrDefault<Schema::Node::ServicedDomains>();
316316
node.Statistics = nodeRowset.GetValueOrDefault<Schema::Node::Statistics>();
317+
node.Name = nodeRowset.GetValueOrDefault<Schema::Node::Name>();
317318
if (nodeRowset.HaveValue<Schema::Node::Location>()) {
318319
auto location = nodeRowset.GetValue<Schema::Node::Location>();
319320
if (location.HasDataCenter()) {

ydb/core/mind/hive/tx__register_node.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@ class TTxRegisterNode : public TTransactionBase<THive> {
4141
} else {
4242
Sort(servicedDomains);
4343
}
44-
db.Table<Schema::Node>().Key(nodeId).Update<Schema::Node::Local, Schema::Node::ServicedDomains, Schema::Node::Statistics>(Local, servicedDomains, node.Statistics);
44+
const TString& name = Record.GetName();
45+
db.Table<Schema::Node>().Key(nodeId).Update(
46+
NIceDb::TUpdate<Schema::Node::Local>(Local),
47+
NIceDb::TUpdate<Schema::Node::ServicedDomains>(servicedDomains),
48+
NIceDb::TUpdate<Schema::Node::Statistics>(node.Statistics),
49+
NIceDb::TUpdate<Schema::Node::Name>(name)
50+
);
51+
4552
node.BecomeDisconnected();
4653
if (node.LastSeenServicedDomains != servicedDomains) {
4754
// new tenant - new rules
@@ -52,6 +59,7 @@ class TTxRegisterNode : public TTransactionBase<THive> {
5259
node.Local = Local;
5360
node.ServicedDomains.swap(servicedDomains);
5461
node.LastSeenServicedDomains = node.ServicedDomains;
62+
node.Name = name;
5563
}
5664
if (Record.HasSystemLocation() && Record.GetSystemLocation().HasDataCenter()) {
5765
node.Location = TNodeLocation(Record.GetSystemLocation());

ydb/core/mind/local.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ class TLocalNodeRegistrar : public TActorBootstrapped<TLocalNodeRegistrar> {
199199
}
200200
tabletAvailability->SetPriority(tabletInfo.Priority);
201201
}
202+
if (const TString& nodeName = AppData(ctx)->NodeName; !nodeName.Empty()) {
203+
request->Record.SetName(nodeName);
204+
}
202205

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

0 commit comments

Comments
 (0)