Skip to content

Commit ce17d11

Browse files
authored
Merge 9db56be into 09ba4d5
2 parents 09ba4d5 + 9db56be commit ce17d11

File tree

7 files changed

+395
-70
lines changed

7 files changed

+395
-70
lines changed

ydb/core/mind/hive/hive_schema.h

+11-1
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,15 @@ struct Schema : NIceDb::Schema {
298298
using TColumns = TableColumns<Node, TabletType, MaxCount>;
299299
};
300300

301+
struct OperationsLog : Table<21> {
302+
struct Timestamp : Column<1, NScheme::NTypeIds::Uint64> {};
303+
struct User : Column<2, NScheme::NTypeIds::String> {};
304+
struct Operation : Column<3, NScheme::NTypeIds::String> { using Type = NKikimrHive::TOperation; };
305+
306+
using TKey = TableKey<Timestamp>;
307+
using TColumns = TableColumns<Timestamp, User, Operation>;
308+
};
309+
301310
using TTables = SchemaTables<
302311
State,
303312
Tablet,
@@ -313,7 +322,8 @@ struct Schema : NIceDb::Schema {
313322
SubDomain,
314323
BlockedOwner,
315324
TabletOwners,
316-
TabletAvailabilityRestrictions
325+
TabletAvailabilityRestrictions,
326+
OperationsLog
317327
>;
318328
using TSettings = SchemaSettings<
319329
ExecutorLogBatching<true>,

ydb/core/mind/hive/monitoring.cpp

+292-64
Large diffs are not rendered by default.

ydb/core/mind/hive/ya.make

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ SRCS(
2525
leader_tablet_info.h
2626
metrics.h
2727
monitoring.cpp
28+
monitoring.h
2829
node_info.cpp
2930
node_info.h
3031
object_distribution.h
@@ -82,6 +83,7 @@ SRCS(
8283
)
8384

8485
PEERDIR(
86+
ydb/library/aclib
8587
ydb/library/actors/core
8688
ydb/library/actors/interconnect
8789
library/cpp/containers/ring_buffer

ydb/core/protos/hive.proto

+36
Original file line numberDiff line numberDiff line change
@@ -567,3 +567,39 @@ message TEvUpdateDomainReply {
567567
optional fixed64 Origin = 1;
568568
optional uint64 TxId = 2;
569569
}
570+
571+
message TConfigUpdate {
572+
optional uint64 FieldNumber = 1;
573+
optional string Value = 2;
574+
}
575+
576+
message TConfigUpdates {
577+
repeated TConfigUpdate ConfigUpdate = 1;
578+
}
579+
580+
message TTabletAvailabilityRestriction {
581+
optional NKikimrTabletBase.TTabletTypes.EType Type = 1;
582+
optional uint64 MaxCount = 2 [default = 1000000];
583+
}
584+
585+
message TNodeOperation {
586+
optional uint32 NodeId = 1;
587+
optional bool Down = 2;
588+
optional bool Freeze = 3;
589+
repeated TTabletAvailabilityRestriction TabletAvailability = 4;
590+
}
591+
592+
message TAllowedMetricsUpdate {
593+
optional NKikimrTabletBase.TTabletTypes.EType Type = 1;
594+
repeated uint64 AllowedMetrics = 2;
595+
}
596+
597+
message TAllowedMetricsUpdates {
598+
repeated TAllowedMetricsUpdate AllowedMetricsUpdate = 1;
599+
}
600+
601+
message TOperation {
602+
optional TConfigUpdates ConfigUpdates = 1;
603+
optional TNodeOperation NodeOperation = 2;
604+
optional TAllowedMetricsUpdates AllowedMetricsUpdates = 3;
605+
}

ydb/core/tablet/tablet_monitoring_proxy.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ class TForwardingActor : public TActorBootstrapped<TForwardingActor> {
3535
return NKikimrServices::TActivity::TABLET_FORWARDING_ACTOR;
3636
}
3737

38-
TForwardingActor(const TTabletMonitoringProxyConfig& config, ui64 targetTablet, bool forceFollower, const TActorId& sender, const NMonitoring::IMonHttpRequest& request)
38+
TForwardingActor(const TTabletMonitoringProxyConfig& config, ui64 targetTablet, bool forceFollower, const TActorId& sender, const NMonitoring::IMonHttpRequest& request, const TString& userToken)
3939
: Config(config)
4040
, TargetTablet(targetTablet)
4141
, ForceFollower(forceFollower)
4242
, Sender(sender)
43-
, Request(ConvertRequestToProtobuf(request))
43+
, Request(ConvertRequestToProtobuf(request, userToken))
4444
{}
4545

46-
static NActorsProto::TRemoteHttpInfo ConvertRequestToProtobuf(const NMonitoring::IMonHttpRequest& request) {
46+
static NActorsProto::TRemoteHttpInfo ConvertRequestToProtobuf(const NMonitoring::IMonHttpRequest& request, const TString& userToken) {
4747
NActorsProto::TRemoteHttpInfo pb;
4848
pb.SetMethod(request.GetMethod());
4949
pb.SetPath(TString(request.GetPathInfo()));
@@ -70,6 +70,7 @@ class TForwardingActor : public TActorBootstrapped<TForwardingActor> {
7070
if (const auto& addr = request.GetRemoteAddr()) {
7171
pb.SetRemoteAddr(addr.data(), addr.size());
7272
}
73+
pb.SetUserToken(userToken);
7374
return pb;
7475
}
7576

@@ -279,7 +280,7 @@ TTabletMonitoringProxyActor::Handle(NMon::TEvHttpInfo::TPtr &ev, const TActorCon
279280
const TString &tabletIdParam = cgi->Get("FollowerID");
280281
const ui64 tabletId = TryParseTabletId(tabletIdParam);
281282
if (tabletId) {
282-
ctx.ExecutorThread.RegisterActor(new TForwardingActor(Config, tabletId, true, ev->Sender, msg->Request));
283+
ctx.ExecutorThread.RegisterActor(new TForwardingActor(Config, tabletId, true, ev->Sender, msg->Request, msg->UserToken));
283284
return;
284285
}
285286
}
@@ -289,7 +290,7 @@ TTabletMonitoringProxyActor::Handle(NMon::TEvHttpInfo::TPtr &ev, const TActorCon
289290
const TString &tabletIdParam = cgi->Get("TabletID");
290291
const ui64 tabletId = TryParseTabletId(tabletIdParam);
291292
if (tabletId) {
292-
ctx.ExecutorThread.RegisterActor(new TForwardingActor(Config, tabletId, false, ev->Sender, msg->Request));
293+
ctx.ExecutorThread.RegisterActor(new TForwardingActor(Config, tabletId, false, ev->Sender, msg->Request, msg->UserToken));
293294
return;
294295
}
295296
}

ydb/library/actors/protos/actors.proto

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ message TRemoteHttpInfo {
3434
optional bytes PostContent = 8;
3535
repeated THeader Headers = 9;
3636
optional string RemoteAddr = 7;
37+
optional string UserToken = 10;
3738

3839
// for compatibility reasons (incorrect field types merged in 21-4)
3940
reserved 5;

ydb/tests/functional/scheme_tests/canondata/tablet_scheme_tests.TestTabletSchemes.test_tablet_schemes_flat_hive_/flat_hive.schema

+47
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,53 @@
549549
}
550550
}
551551
},
552+
{
553+
"TableId": 21,
554+
"TableName": "OperationsLog",
555+
"TableKey": [
556+
1
557+
],
558+
"ColumnsAdded": [
559+
{
560+
"ColumnId": 1,
561+
"ColumnName": "Timestamp",
562+
"ColumnType": "Uint64"
563+
},
564+
{
565+
"ColumnId": 2,
566+
"ColumnName": "User",
567+
"ColumnType": "String"
568+
},
569+
{
570+
"ColumnId": 3,
571+
"ColumnName": "Operation",
572+
"ColumnType": "String"
573+
}
574+
],
575+
"ColumnsDropped": [],
576+
"ColumnFamilies": {
577+
"0": {
578+
"Columns": [
579+
1,
580+
2,
581+
3
582+
],
583+
"RoomID": 0,
584+
"Codec": 0,
585+
"InMemory": false,
586+
"Cache": 0,
587+
"Small": 4294967295,
588+
"Large": 4294967295
589+
}
590+
},
591+
"Rooms": {
592+
"0": {
593+
"Main": 1,
594+
"Outer": 1,
595+
"Blobs": 1
596+
}
597+
}
598+
},
552599
{
553600
"TableId": 4,
554601
"TableName": "Node",

0 commit comments

Comments
 (0)