diff options
author | Alexander Rutkovsky <alexvru@mail.ru> | 2022-02-18 21:57:45 +0300 |
---|---|---|
committer | Alexander Rutkovsky <alexvru@mail.ru> | 2022-02-18 21:57:45 +0300 |
commit | 6890728afc1e9eb1fdd5ffec2fb87c7f46f5e530 (patch) | |
tree | 19625462ded80d6672d92b4577c821a6165b4bbe | |
parent | 5291e2f6c447d149f3dc17006419bc7411478148 (diff) | |
download | ydb-6890728afc1e9eb1fdd5ffec2fb87c7f46f5e530.tar.gz |
Add counters for number of unconnected disks to ds proxy KIKIMR-13568
ref:75801ddb5751aef9278677fd0cbd6f70fb61510c
-rw-r--r-- | ydb/core/blobstorage/dsproxy/dsproxy_impl.h | 2 | ||||
-rw-r--r-- | ydb/core/blobstorage/dsproxy/dsproxy_nodemon.cpp | 4 | ||||
-rw-r--r-- | ydb/core/blobstorage/dsproxy/dsproxy_nodemon.h | 22 | ||||
-rw-r--r-- | ydb/core/blobstorage/dsproxy/dsproxy_state.cpp | 11 | ||||
-rw-r--r-- | ydb/core/blobstorage/dsproxy/group_sessions.cpp | 8 | ||||
-rw-r--r-- | ydb/core/blobstorage/dsproxy/group_sessions.h | 1 |
6 files changed, 48 insertions, 0 deletions
diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_impl.h b/ydb/core/blobstorage/dsproxy/dsproxy_impl.h index 508eb10a05..25eee78a6e 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_impl.h +++ b/ydb/core/blobstorage/dsproxy/dsproxy_impl.h @@ -175,6 +175,8 @@ class TBlobStorageGroupProxy : public TActorBootstrapped<TBlobStorageGroupProxy> //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Establishing Sessions state + ui32 NumUnconnectedDisks = Max<ui32>(); + void SwitchToWorkWhenGoodToGo(); void WakeupEstablishingSessions(TEvEstablishingSessionTimeout::TPtr ev); void Handle(TEvProxyQueueState::TPtr& ev); diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_nodemon.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_nodemon.cpp index addca8c533..b12c5fcf89 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_nodemon.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_nodemon.cpp @@ -81,6 +81,10 @@ TDsProxyNodeMon::TDsProxyNodeMon(TIntrusivePtr<NMonitoring::TDynamicCounters> &c EstablishingSessionsTimeout5min = group->GetCounter("EstablishingSessionsTimeout5min", false); UnconfiguredTimeout = group->GetCounter("UnconfiguredTimeout", false); UnconfiguredTimeout5min = group->GetCounter("UnconfiguredTimeout5min", false); + ConnectedAll = group->GetCounter("ConnectedAll", false); + ConnectedMinus1 = group->GetCounter("ConnectedMinus1", false); + ConnectedMinus2 = group->GetCounter("ConnectedMinus2", false); + ConnectedMinus3more = group->GetCounter("ConnectedMinus3more", false); } } diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_nodemon.h b/ydb/core/blobstorage/dsproxy/dsproxy_nodemon.h index 150da172fb..956e470e37 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_nodemon.h +++ b/ydb/core/blobstorage/dsproxy/dsproxy_nodemon.h @@ -89,6 +89,10 @@ struct TDsProxyNodeMon : public TThrRefBase { NMonitoring::TDynamicCounters::TCounterPtr EstablishingSessionsTimeout5min; NMonitoring::TDynamicCounters::TCounterPtr UnconfiguredTimeout; NMonitoring::TDynamicCounters::TCounterPtr UnconfiguredTimeout5min; + NMonitoring::TDynamicCounters::TCounterPtr ConnectedAll; + NMonitoring::TDynamicCounters::TCounterPtr ConnectedMinus1; + NMonitoring::TDynamicCounters::TCounterPtr ConnectedMinus2; + NMonitoring::TDynamicCounters::TCounterPtr ConnectedMinus3more; TDsProxyNodeMon(TIntrusivePtr<NMonitoring::TDynamicCounters> &counters, bool initForAllDeviceTypes); void CountPutPesponseTime(TPDiskCategory::EDeviceType type, NKikimrBlobStorage::EPutHandleClass cls, ui32 size, @@ -99,6 +103,24 @@ struct TDsProxyNodeMon : public TThrRefBase { // Called only from NodeWarder void CheckNodeMonCountersForDeviceType(TPDiskCategory::EDeviceType type); + + void IncNumUnconnected(ui32 num) { + switch (num) { + case 0: ++*ConnectedAll; break; + case 1: ++*ConnectedMinus1; break; + case 2: ++*ConnectedMinus2; break; + default: ++*ConnectedMinus3more; break; + } + } + + void DecNumUnconnected(ui32 num) { + switch (num) { + case 0: --*ConnectedAll; break; + case 1: --*ConnectedMinus1; break; + case 2: --*ConnectedMinus2; break; + default: --*ConnectedMinus3more; break; + } + } }; } // NKikimr diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_state.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_state.cpp index af2739699d..9cf4b55e58 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_state.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_state.cpp @@ -151,6 +151,8 @@ namespace NKikimr { } else { // this is the first time configuration arrives -- no queues are created yet EnsureMonitoring(false); Sessions = MakeIntrusive<TGroupSessions>(Info, BSProxyCtx, MonActor, SelfId()); + NumUnconnectedDisks = Sessions->GetNumUnconnectedDisks(); + NodeMon->IncNumUnconnected(NumUnconnectedDisks); } SetStateEstablishingSessions(); } else { // configuration has been reset, we have to request it via NodeWarden @@ -208,6 +210,11 @@ namespace NKikimr { CurrentStateFunc() == &TThis::StateEstablishingSessionsTimeout)) { SwitchToWorkWhenGoodToGo(); } + + if (const ui32 prev = std::exchange(NumUnconnectedDisks, Sessions->GetNumUnconnectedDisks()); prev != NumUnconnectedDisks) { + NodeMon->IncNumUnconnected(NumUnconnectedDisks); + NodeMon->DecNumUnconnected(prev); + } } void TBlobStorageGroupProxy::Bootstrap() { @@ -256,6 +263,10 @@ namespace NKikimr { ErrorDescription = "DsProxy got a Poison Pill"; SetStateEstablishingSessionsTimeout(); + if (NumUnconnectedDisks != Max<ui32>()) { + NodeMon->DecNumUnconnected(NumUnconnectedDisks); + } + TActorBootstrapped::PassAway(); // TODO: Unsubscribe } diff --git a/ydb/core/blobstorage/dsproxy/group_sessions.cpp b/ydb/core/blobstorage/dsproxy/group_sessions.cpp index 016952e1e2..9923c6b784 100644 --- a/ydb/core/blobstorage/dsproxy/group_sessions.cpp +++ b/ydb/core/blobstorage/dsproxy/group_sessions.cpp @@ -122,4 +122,12 @@ void TGroupSessions::QueueConnectUpdate(ui32 orderNumber, NKikimrBlobStorage::EV } } +ui32 TGroupSessions::GetNumUnconnectedDisks() { + ui32 n = 0; + for (const ui8 mask : ConnectedQueuesMask) { + n += mask != AllQueuesMask; + } + return n; +} + } // NKikimr diff --git a/ydb/core/blobstorage/dsproxy/group_sessions.h b/ydb/core/blobstorage/dsproxy/group_sessions.h index b4b9db6284..9284051408 100644 --- a/ydb/core/blobstorage/dsproxy/group_sessions.h +++ b/ydb/core/blobstorage/dsproxy/group_sessions.h @@ -221,6 +221,7 @@ namespace NKikimr { void Poison(); bool GoodToGo(const TBlobStorageGroupInfo::TTopology& topology, bool waitForAllVDisks); void QueueConnectUpdate(ui32 orderNumber, NKikimrBlobStorage::EVDiskQueueId queueId, bool connected); + ui32 GetNumUnconnectedDisks(); }; struct TEvRequestProxySessionsState : TEventLocal<TEvRequestProxySessionsState, TEvBlobStorage::EvRequestProxySessionsState> |