aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexvru <alexvru@ydb.tech>2022-11-01 17:49:31 +0300
committeralexvru <alexvru@ydb.tech>2022-11-01 17:49:31 +0300
commit31f51049ff883f69143f6618b930f26569d8c727 (patch)
treedcafbc6d548dbd3a6e7f003925c46b266789ebe2
parente1fc222ef76a75694f8b5fb27e35b77c7b36399d (diff)
downloadydb-31f51049ff883f69143f6618b930f26569d8c727.tar.gz
Report group metrics to whiteboard
-rw-r--r--ydb/core/blob_depot/defs.h1
-rw-r--r--ydb/core/blob_depot/group_metrics_exchange.cpp30
-rw-r--r--ydb/core/cms/cms_ut_common.h1
-rw-r--r--ydb/core/health_check/health_check.cpp6
-rw-r--r--ydb/core/mind/hive/hive_ut.cpp4
-rw-r--r--ydb/core/mind/local.cpp3
-rw-r--r--ydb/core/node_whiteboard/node_whiteboard.h4
-rw-r--r--ydb/core/viewer/json_pipe_req.h16
8 files changed, 46 insertions, 19 deletions
diff --git a/ydb/core/blob_depot/defs.h b/ydb/core/blob_depot/defs.h
index 807509fd456..7b191ee5a54 100644
--- a/ydb/core/blob_depot/defs.h
+++ b/ydb/core/blob_depot/defs.h
@@ -8,6 +8,7 @@
#include <ydb/core/blobstorage/testing/group_overseer/group_overseer.h>
#include <ydb/core/blobstorage/vdisk/common/vdisk_events.h>
#include <ydb/core/engine/minikql/flat_local_tx_factory.h>
+#include <ydb/core/node_whiteboard/node_whiteboard.h>
#include <ydb/core/tablet_flat/tablet_flat_executed.h>
#include <ydb/core/tablet_flat/flat_cxx_database.h>
#include <ydb/core/protos/blob_depot.pb.h>
diff --git a/ydb/core/blob_depot/group_metrics_exchange.cpp b/ydb/core/blob_depot/group_metrics_exchange.cpp
index 977cbe5881e..6dfae1f33ab 100644
--- a/ydb/core/blob_depot/group_metrics_exchange.cpp
+++ b/ydb/core/blob_depot/group_metrics_exchange.cpp
@@ -1,4 +1,5 @@
#include "blob_depot_tablet.h"
+#include "data.h"
namespace NKikimr::NBlobDepot {
@@ -47,6 +48,8 @@ namespace NKikimr::NBlobDepot {
to->SetWriteThroughput(to->GetWriteThroughput() + from.GetWriteThroughput());
};
+ std::unordered_set<ui32> processedDataGroups;
+
for (const auto& channel : Info()->Channels) {
if (auto *entry = channel.LatestEntry(); entry && channel.Channel < Channels.size()) {
TChannelInfo& ch = Channels[channel.Channel];
@@ -58,14 +61,15 @@ namespace NKikimr::NBlobDepot {
break;
case NKikimrBlobDepot::TChannelKind::Data:
- dataColor = Min(dataColor, p.GetSpaceColor());
- params->SetAvailableSize(params->GetAvailableSize() + p.GetAvailableSize());
- params->SetAllocatedSize(params->GetAllocatedSize() + p.GetAllocatedSize());
- if (p.HasAssuredResources()) {
- addResources(params->MutableAssuredResources(), p.GetAssuredResources());
- }
- if (p.HasCurrentResources()) {
- addResources(params->MutableCurrentResources(), p.GetCurrentResources());
+ if (processedDataGroups.insert(entry->GroupID).second) { // count each data group exactly once
+ dataColor = Min(dataColor, p.GetSpaceColor());
+ params->SetAvailableSize(params->GetAvailableSize() + p.GetAvailableSize());
+ if (p.HasAssuredResources()) {
+ addResources(params->MutableAssuredResources(), p.GetAssuredResources());
+ }
+ if (p.HasCurrentResources()) {
+ addResources(params->MutableCurrentResources(), p.GetCurrentResources());
+ }
}
break;
@@ -76,6 +80,16 @@ namespace NKikimr::NBlobDepot {
}
}
+ auto ev = std::make_unique<NNodeWhiteboard::TEvWhiteboard::TEvBSGroupStateUpdate>();
+ auto& wb = ev->Record;
+ wb.SetGroupID(Config.GetVirtualGroupId());
+ wb.SetAllocatedSize(Data->GetTotalStoredDataSize());
+ wb.SetAvailableSize(params->GetAvailableSize());
+ wb.SetReadThroughput(0);
+ wb.SetWriteThroughput(0);
+ Send(NNodeWhiteboard::MakeNodeWhiteboardServiceId(SelfId().NodeId()), ev.release());
+
+ params->SetAllocatedSize(Data->GetTotalStoredDataSize());
Send(MakeBlobStorageNodeWardenID(SelfId().NodeId()), response.release());
}
}
diff --git a/ydb/core/cms/cms_ut_common.h b/ydb/core/cms/cms_ut_common.h
index 0e1759cda6b..831b29407ca 100644
--- a/ydb/core/cms/cms_ut_common.h
+++ b/ydb/core/cms/cms_ut_common.h
@@ -16,6 +16,7 @@
namespace NKikimr {
namespace NCmsTest {
+using NNodeWhiteboard::TTabletId;
using TNodeTenantsMap = THashMap<ui32, TVector<TString>>;
struct TFakeNodeInfo {
diff --git a/ydb/core/health_check/health_check.cpp b/ydb/core/health_check/health_check.cpp
index f0f950dc558..ae0e6609430 100644
--- a/ydb/core/health_check/health_check.cpp
+++ b/ydb/core/health_check/health_check.cpp
@@ -54,6 +54,10 @@ struct hash<NKikimrBlobStorage::TVSlotId> {
#define BLOG_CRIT(stream) LOG_CRIT_S(*TlsActivationContext, NKikimrServices::HEALTH, stream)
namespace NKikimr {
+
+using NNodeWhiteboard::TNodeId;
+using NNodeWhiteboard::TTabletId;
+
namespace NHealthCheck {
using namespace NActors;
@@ -194,7 +198,7 @@ public:
TPathId ResourcePathId = {};
TVector<TNodeId> ComputeNodeIds;
TVector<TString> StoragePoolNames;
- THashMap<std::pair<TTabletId, TFollowerId>, const NKikimrHive::TTabletInfo*> MergedTabletState;
+ THashMap<std::pair<TTabletId, NNodeWhiteboard::TFollowerId>, const NKikimrHive::TTabletInfo*> MergedTabletState;
THashMap<TNodeId, TNodeTabletState> MergedNodeTabletState;
};
diff --git a/ydb/core/mind/hive/hive_ut.cpp b/ydb/core/mind/hive/hive_ut.cpp
index bd2036621e3..a4e7277a90e 100644
--- a/ydb/core/mind/hive/hive_ut.cpp
+++ b/ydb/core/mind/hive/hive_ut.cpp
@@ -50,6 +50,10 @@ static constexpr bool ENABLE_DETAILED_HIVE_LOG = false;
const char *DOMAIN_NAME = "dc-1";
namespace NKikimr {
+
+using NNodeWhiteboard::TTabletId;
+using NNodeWhiteboard::TFollowerId;
+
namespace {
using namespace NActors;
diff --git a/ydb/core/mind/local.cpp b/ydb/core/mind/local.cpp
index 2867e47adf8..011a9939b57 100644
--- a/ydb/core/mind/local.cpp
+++ b/ydb/core/mind/local.cpp
@@ -26,6 +26,9 @@ void Out<std::pair<ui64, ui32>>(IOutputStream& out, const std::pair<ui64, ui32>&
}
namespace NKikimr {
+
+using NNodeWhiteboard::TTabletId;
+
class TLocalNodeRegistrar : public TActorBootstrapped<TLocalNodeRegistrar> {
struct TEvPrivate {
enum EEv {
diff --git a/ydb/core/node_whiteboard/node_whiteboard.h b/ydb/core/node_whiteboard/node_whiteboard.h
index 8a986dead82..6dcadba6e62 100644
--- a/ydb/core/node_whiteboard/node_whiteboard.h
+++ b/ydb/core/node_whiteboard/node_whiteboard.h
@@ -13,12 +13,12 @@
namespace NKikimr {
+namespace NNodeWhiteboard {
+
using TTabletId = ui64;
using TFollowerId = ui32;
using TNodeId = ui32;
-namespace NNodeWhiteboard {
-
struct TEvWhiteboard{
enum EEv {
EvTabletStateUpdate = EventSpaceBegin(TKikimrEvents::ES_NODE_WHITEBOARD),
diff --git a/ydb/core/viewer/json_pipe_req.h b/ydb/core/viewer/json_pipe_req.h
index d41b2a93d4f..9af853d7a0f 100644
--- a/ydb/core/viewer/json_pipe_req.h
+++ b/ydb/core/viewer/json_pipe_req.h
@@ -31,7 +31,7 @@ protected:
ui32 Requests = 0;
};
- std::unordered_map<TTabletId, TPipeInfo> PipeInfo;
+ std::unordered_map<NNodeWhiteboard::TTabletId, TPipeInfo> PipeInfo;
struct TDelayedRequest {
std::unique_ptr<IEventHandle> Event;
@@ -47,7 +47,7 @@ protected:
return clientConfig;
}
- TActorId ConnectTabletPipe(TTabletId tabletId) {
+ TActorId ConnectTabletPipe(NNodeWhiteboard::TTabletId tabletId) {
TPipeInfo& pipeInfo = PipeInfo[tabletId];
if (!pipeInfo.PipeClient) {
auto pipe = NTabletPipe::CreateClient(TBase::SelfId(), tabletId, GetPipeClientConfig());
@@ -87,7 +87,7 @@ protected:
}
}
- void RequestHiveDomainStats(TTabletId hiveId) {
+ void RequestHiveDomainStats(NNodeWhiteboard::TTabletId hiveId) {
TActorId pipeClient = ConnectTabletPipe(hiveId);
THolder<TEvHive::TEvRequestHiveDomainStats> request = MakeHolder<TEvHive::TEvRequestHiveDomainStats>();
request->Record.SetReturnFollowers(Followers);
@@ -95,20 +95,20 @@ protected:
SendRequestToPipe(pipeClient, request.Release(), hiveId);
}
- void RequestHiveNodeStats(TTabletId hiveId) {
+ void RequestHiveNodeStats(NNodeWhiteboard::TTabletId hiveId) {
TActorId pipeClient = ConnectTabletPipe(hiveId);
THolder<TEvHive::TEvRequestHiveNodeStats> request = MakeHolder<TEvHive::TEvRequestHiveNodeStats>();
request->Record.SetReturnMetrics(Metrics);
SendRequestToPipe(pipeClient, request.Release(), hiveId);
}
- void RequestHiveStorageStats(TTabletId hiveId) {
+ void RequestHiveStorageStats(NNodeWhiteboard::TTabletId hiveId) {
TActorId pipeClient = ConnectTabletPipe(hiveId);
THolder<TEvHive::TEvRequestHiveStorageStats> request = MakeHolder<TEvHive::TEvRequestHiveStorageStats>();
SendRequestToPipe(pipeClient, request.Release(), hiveId);
}
- TTabletId GetConsoleId() {
+ NNodeWhiteboard::TTabletId GetConsoleId() {
TIntrusivePtr<TDomainsInfo> domains = AppData()->DomainsInfo;
TIntrusivePtr<TDomainsInfo::TDomain> domain = domains->Domains.begin()->second;
auto group = domains->GetDefaultStateStorageGroup(domain->DomainUid);
@@ -128,7 +128,7 @@ protected:
SendRequestToPipe(pipeClient, request.Release());
}
- TTabletId GetBSControllerId() {
+ NNodeWhiteboard::TTabletId GetBSControllerId() {
TIntrusivePtr<TDomainsInfo> domains = AppData()->DomainsInfo;
TIntrusivePtr<TDomainsInfo::TDomain> domain = domains->Domains.begin()->second;
ui32 stateStorageGroup = domains->GetDefaultStateStorageGroup(domain->DomainUid);
@@ -189,7 +189,7 @@ protected:
PipeInfo.clear();
}
- ui32 FailPipeConnect(TTabletId tabletId) {
+ ui32 FailPipeConnect(NNodeWhiteboard::TTabletId tabletId) {
auto itPipeInfo = PipeInfo.find(tabletId);
if (itPipeInfo != PipeInfo.end()) {
ui32 requests = itPipeInfo->second.Requests;