Skip to content

Commit 5190f5b

Browse files
authored
Merge c4dac2b into 014dff3
2 parents 014dff3 + c4dac2b commit 5190f5b

21 files changed

+303
-167
lines changed

ydb/core/mind/hive/balancer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,9 @@ class THiveBalancer : public NActors::TActorBootstrapped<THiveBalancer>, public
325325
tablet->ActorsToNotifyOnRestart.emplace_back(SelfId()); // volatile settings, will not persist upon restart
326326
++KickInFlight;
327327
++Movements;
328-
BLOG_D("Balancer moving tablet " << tablet->ToString() << " " << tablet->GetResourceValues()
329-
<< " from node " << tablet->Node->Id << " " << tablet->Node->ResourceValues
330-
<< " to node " << node->Id << " " << node->ResourceValues);
328+
BLOG_D("Balancer moving tablet " << tablet->ToString()
329+
<< " from node " << tablet->Node->Id
330+
<< " to node " << node->Id);
331331
Hive->RecordTabletMove(THive::TTabletMoveInfo(now, *tablet, tablet->Node->Id, node->Id));
332332
Hive->Execute(Hive->CreateRestartTablet(tablet->GetFullTabletId(), node->Id));
333333
UpdateProgress();

ydb/core/mind/hive/drain.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,17 @@ class THiveDrain : public NActors::TActorBootstrapped<THiveDrain>, public ISubAc
8585
++KickInFlight;
8686
++Movements;
8787
BLOG_D("Drain " << SelfId() << " moving tablet "
88-
<< tablet->ToString() << " " << tablet->GetResourceValues()
89-
<< " from node " << tablet->Node->Id << " " << tablet->Node->ResourceValues
90-
<< " to node " << node->Id << " " << node->ResourceValues);
88+
<< tablet->ToString()
89+
<< " from node " << tablet->Node->Id
90+
<< " to node " << node->Id);
9191
Hive->TabletCounters->Cumulative()[NHive::COUNTER_DRAIN_EXECUTED].Increment(1);
9292
Hive->RecordTabletMove(THive::TTabletMoveInfo(TInstant::Now(), *tablet, tablet->Node->Id, node->Id));
9393
Hive->Execute(Hive->CreateRestartTablet(tabletId, node->Id));
9494
} else {
9595
if (std::holds_alternative<THive::TNoNodeFound>(result) || std::holds_alternative<THive::TNotEnoughResources>(result)) {
9696
Hive->TabletCounters->Cumulative()[NHive::COUNTER_DRAIN_FAILED].Increment(1);
97-
BLOG_D("Drain " << SelfId() << " could not move tablet " << tablet->ToString() << " " << tablet->GetResourceValues()
98-
<< " from node " << tablet->Node->Id << " " << tablet->Node->ResourceValues);
97+
BLOG_D("Drain " << SelfId() << " could not move tablet " << tablet->ToString()
98+
<< " from node " << tablet->Node->Id);
9999
} else if (std::holds_alternative<THive::TTooManyTabletsStarting>(result)){
100100
BLOG_D("Drain " << SelfId() << " could not move tablet " << tablet->ToString() << " and will try again later");
101101
Hive->WaitToMoveTablets(SelfId());

ydb/core/mind/hive/fill.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ class THiveFill : public NActors::TActorBootstrapped<THiveFill>, public ISubActo
6161
tablet->ActorsToNotifyOnRestart.emplace_back(SelfId()); // volatile settings, will not persist upon restart
6262
++KickInFlight;
6363
++Movements;
64-
BLOG_D("Fill " << SelfId() << " moving tablet " << tablet->ToString() << " " << tablet->GetResourceValues()
65-
<< " from node " << tablet->Node->Id << " " << tablet->Node->ResourceValues
66-
<< " to node " << node->Id << " " << node->ResourceValues);
64+
BLOG_D("Fill " << SelfId() << " moving tablet " << tablet->ToString()
65+
<< " from node " << tablet->Node->Id
66+
<< " to node " << node->Id);
6767
Hive->TabletCounters->Cumulative()[NHive::COUNTER_FILL_EXECUTED].Increment(1);
6868
Hive->RecordTabletMove(THive::TTabletMoveInfo(TInstant::Now(), *tablet, tablet->Node->Id, node->Id));
6969
Hive->Execute(Hive->CreateRestartTablet(tablet->GetFullTabletId(), node->Id), ctx);

ydb/core/mind/hive/hive.cpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,53 @@ bool TNodeFilter::IsAllowedPile(TBridgePileId pile) const {
119119
}
120120
}
121121

122+
TMetrics& TMetrics::operator+=(const TMetrics& other) {
123+
CPU += other.CPU;
124+
Memory += other.Memory;
125+
Network += other.Network;
126+
Counter += other.Counter;
127+
Storage += other.Storage;
128+
ReadThroughput += other.ReadThroughput;
129+
WriteThroughput += other.WriteThroughput;
130+
ReadIops += other.ReadIops;
131+
WriteIops += other.WriteIops;
132+
return *this;
133+
}
134+
135+
void TMetrics::ToProto(NKikimrTabletBase::TMetrics* proto) const {
136+
if (CPU) {
137+
proto->SetCPU(CPU);
138+
}
139+
if (Memory) {
140+
proto->SetMemory(Memory);
141+
}
142+
if (Network) {
143+
proto->SetNetwork(Network);
144+
}
145+
if (Counter) {
146+
proto->SetCounter(Counter);
147+
}
148+
if (Storage) {
149+
proto->SetStorage(Storage);
150+
}
151+
if (ReadThroughput) {
152+
proto->SetReadThroughput(ReadThroughput);
153+
}
154+
if (WriteThroughput) {
155+
proto->SetWriteThroughput(WriteThroughput);
156+
}
157+
if (ReadIops) {
158+
proto->SetReadIops(ReadIops);
159+
}
160+
if (WriteIops) {
161+
proto->SetWriteIops(WriteIops);
162+
}
163+
proto->MutableGroupReadThroughput()->Assign(GroupReadThroughput.begin(), GroupReadThroughput.end());
164+
proto->MutableGroupWriteThroughput()->Assign(GroupWriteThroughput.begin(), GroupWriteThroughput.end());
165+
proto->MutableGroupReadIops()->Assign(GroupReadIops.begin(), GroupReadIops.end());
166+
proto->MutableGroupWriteIops()->Assign(GroupWriteIops.begin(), GroupWriteIops.end());
167+
}
168+
122169
template <typename K, typename V>
123170
std::unordered_map<V, K> MakeReverseMap(const std::unordered_map<K, V>& map) {
124171
std::unordered_map<V, K> result;

ydb/core/mind/hive/hive.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,27 @@ struct TFollowerUpdates {
381381
}
382382
};
383383

384+
// same as NKikimrTabletBase::TMetrics, except not a protobuf - for lighter operations
385+
struct TMetrics {
386+
ui64 CPU = 0;
387+
ui64 Memory = 0;
388+
ui64 Network = 0;
389+
ui64 Counter = 0;
390+
ui64 Storage = 0;
391+
TVector<NKikimrTabletBase::TThroughputRecord> GroupReadThroughput;
392+
TVector<NKikimrTabletBase::TThroughputRecord> GroupWriteThroughput;
393+
ui64 ReadThroughput = 0;
394+
ui64 WriteThroughput = 0;
395+
TVector<NKikimrTabletBase::TIopsRecord> GroupReadIops;
396+
TVector<NKikimrTabletBase::TIopsRecord> GroupWriteIops;
397+
ui64 ReadIops = 0;
398+
ui64 WriteIops = 0;
399+
400+
TMetrics& operator+=(const TMetrics& other);
401+
402+
void ToProto(NKikimrTabletBase::TMetrics* proto) const;
403+
};
404+
384405

385406
} // NHive
386407
} // NKikimr

ydb/core/mind/hive/hive_events.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ struct TEvPrivate {
3939
EvRefreshScaleRecommendation,
4040
EvUpdateFollowers,
4141
EvUpdateBalanceCounters,
42+
EvProcessMetrics,
4243
EvEnd
4344
};
4445

@@ -145,6 +146,8 @@ struct TEvPrivate {
145146
};
146147

147148
struct TEvUpdateBalanceCounters : TEventLocal<TEvUpdateBalanceCounters, EvUpdateBalanceCounters> {};
149+
150+
struct TEvProcessMetrics : TEventLocal<TEvProcessMetrics, EvProcessMetrics> {};
148151
};
149152

150153
} // NHive

0 commit comments

Comments
 (0)