Skip to content
Open
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
6 changes: 3 additions & 3 deletions ydb/core/mind/hive/balancer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,9 @@ class THiveBalancer : public NActors::TActorBootstrapped<THiveBalancer>, public
tablet->ActorsToNotifyOnRestart.emplace_back(SelfId()); // volatile settings, will not persist upon restart
++KickInFlight;
++Movements;
BLOG_D("Balancer moving tablet " << tablet->ToString() << " " << tablet->GetResourceValues()
<< " from node " << tablet->Node->Id << " " << tablet->Node->ResourceValues
<< " to node " << node->Id << " " << node->ResourceValues);
BLOG_D("Balancer moving tablet " << tablet->ToString()
<< " from node " << tablet->Node->Id
<< " to node " << node->Id);
Hive->RecordTabletMove(THive::TTabletMoveInfo(now, *tablet, tablet->Node->Id, node->Id));
Hive->Execute(Hive->CreateRestartTablet(tablet->GetFullTabletId(), node->Id));
UpdateProgress();
Expand Down
10 changes: 5 additions & 5 deletions ydb/core/mind/hive/drain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,17 @@ class THiveDrain : public NActors::TActorBootstrapped<THiveDrain>, public ISubAc
++KickInFlight;
++Movements;
BLOG_D("Drain " << SelfId() << " moving tablet "
<< tablet->ToString() << " " << tablet->GetResourceValues()
<< " from node " << tablet->Node->Id << " " << tablet->Node->ResourceValues
<< " to node " << node->Id << " " << node->ResourceValues);
<< tablet->ToString()
<< " from node " << tablet->Node->Id
<< " to node " << node->Id);
Hive->TabletCounters->Cumulative()[NHive::COUNTER_DRAIN_EXECUTED].Increment(1);
Hive->RecordTabletMove(THive::TTabletMoveInfo(TInstant::Now(), *tablet, tablet->Node->Id, node->Id));
Hive->Execute(Hive->CreateRestartTablet(tabletId, node->Id));
} else {
if (std::holds_alternative<THive::TNoNodeFound>(result) || std::holds_alternative<THive::TNotEnoughResources>(result)) {
Hive->TabletCounters->Cumulative()[NHive::COUNTER_DRAIN_FAILED].Increment(1);
BLOG_D("Drain " << SelfId() << " could not move tablet " << tablet->ToString() << " " << tablet->GetResourceValues()
<< " from node " << tablet->Node->Id << " " << tablet->Node->ResourceValues);
BLOG_D("Drain " << SelfId() << " could not move tablet " << tablet->ToString()
<< " from node " << tablet->Node->Id);
} else if (std::holds_alternative<THive::TTooManyTabletsStarting>(result)){
BLOG_D("Drain " << SelfId() << " could not move tablet " << tablet->ToString() << " and will try again later");
Hive->WaitToMoveTablets(SelfId());
Expand Down
6 changes: 3 additions & 3 deletions ydb/core/mind/hive/fill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ class THiveFill : public NActors::TActorBootstrapped<THiveFill>, public ISubActo
tablet->ActorsToNotifyOnRestart.emplace_back(SelfId()); // volatile settings, will not persist upon restart
++KickInFlight;
++Movements;
BLOG_D("Fill " << SelfId() << " moving tablet " << tablet->ToString() << " " << tablet->GetResourceValues()
<< " from node " << tablet->Node->Id << " " << tablet->Node->ResourceValues
<< " to node " << node->Id << " " << node->ResourceValues);
BLOG_D("Fill " << SelfId() << " moving tablet " << tablet->ToString()
<< " from node " << tablet->Node->Id
<< " to node " << node->Id);
Hive->TabletCounters->Cumulative()[NHive::COUNTER_FILL_EXECUTED].Increment(1);
Hive->RecordTabletMove(THive::TTabletMoveInfo(TInstant::Now(), *tablet, tablet->Node->Id, node->Id));
Hive->Execute(Hive->CreateRestartTablet(tablet->GetFullTabletId(), node->Id), ctx);
Expand Down
47 changes: 47 additions & 0 deletions ydb/core/mind/hive/hive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,53 @@ bool TNodeFilter::IsAllowedPile(TBridgePileId pile) const {
}
}

TMetrics& TMetrics::operator+=(const TMetrics& other) {
CPU += other.CPU;
Memory += other.Memory;
Network += other.Network;
Counter += other.Counter;
Storage += other.Storage;
ReadThroughput += other.ReadThroughput;
WriteThroughput += other.WriteThroughput;
ReadIops += other.ReadIops;
WriteIops += other.WriteIops;
return *this;
}

void TMetrics::ToProto(NKikimrTabletBase::TMetrics* proto) const {
if (CPU) {
proto->SetCPU(CPU);
}
if (Memory) {
proto->SetMemory(Memory);
}
if (Network) {
proto->SetNetwork(Network);
}
if (Counter) {
proto->SetCounter(Counter);
}
if (Storage) {
proto->SetStorage(Storage);
}
if (ReadThroughput) {
proto->SetReadThroughput(ReadThroughput);
}
if (WriteThroughput) {
proto->SetWriteThroughput(WriteThroughput);
}
if (ReadIops) {
proto->SetReadIops(ReadIops);
}
if (WriteIops) {
proto->SetWriteIops(WriteIops);
}
proto->MutableGroupReadThroughput()->Assign(GroupReadThroughput.begin(), GroupReadThroughput.end());
proto->MutableGroupWriteThroughput()->Assign(GroupWriteThroughput.begin(), GroupWriteThroughput.end());
proto->MutableGroupReadIops()->Assign(GroupReadIops.begin(), GroupReadIops.end());
proto->MutableGroupWriteIops()->Assign(GroupWriteIops.begin(), GroupWriteIops.end());
}

template <typename K, typename V>
std::unordered_map<V, K> MakeReverseMap(const std::unordered_map<K, V>& map) {
std::unordered_map<V, K> result;
Expand Down
21 changes: 21 additions & 0 deletions ydb/core/mind/hive/hive.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,27 @@ struct TFollowerUpdates {
}
};

// same as NKikimrTabletBase::TMetrics, except not a protobuf - for lighter operations
struct TMetrics {
ui64 CPU = 0;
ui64 Memory = 0;
ui64 Network = 0;
ui64 Counter = 0;
ui64 Storage = 0;
TVector<NKikimrTabletBase::TThroughputRecord> GroupReadThroughput;
TVector<NKikimrTabletBase::TThroughputRecord> GroupWriteThroughput;
ui64 ReadThroughput = 0;
ui64 WriteThroughput = 0;
TVector<NKikimrTabletBase::TIopsRecord> GroupReadIops;
TVector<NKikimrTabletBase::TIopsRecord> GroupWriteIops;
ui64 ReadIops = 0;
ui64 WriteIops = 0;

TMetrics& operator+=(const TMetrics& other);

void ToProto(NKikimrTabletBase::TMetrics* proto) const;
};


} // NHive
} // NKikimr
Expand Down
3 changes: 3 additions & 0 deletions ydb/core/mind/hive/hive_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct TEvPrivate {
EvRefreshScaleRecommendation,
EvUpdateFollowers,
EvUpdateBalanceCounters,
EvProcessMetrics,
EvEnd
};

Expand Down Expand Up @@ -145,6 +146,8 @@ struct TEvPrivate {
};

struct TEvUpdateBalanceCounters : TEventLocal<TEvUpdateBalanceCounters, EvUpdateBalanceCounters> {};

struct TEvProcessMetrics : TEventLocal<TEvProcessMetrics, EvProcessMetrics> {};
};

} // NHive
Expand Down
Loading
Loading