aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkruall <kruall@ydb.tech>2022-12-19 12:10:20 +0300
committerkruall <kruall@ydb.tech>2022-12-19 12:10:20 +0300
commit74713094e152d366e2b66c406b09ea5166cf9adf (patch)
treec1937d546f6e2096657df37061620401aca101c9
parent52a9e6a2c317d50ff61a20a705c0848623256c1d (diff)
downloadydb-74713094e152d366e2b66c406b09ea5166cf9adf.tar.gz
Add api for dstool,
-rw-r--r--ydb/core/base/blobstorage.h2
-rw-r--r--ydb/core/blobstorage/vdisk/common/vdisk_events.h27
-rw-r--r--ydb/core/blobstorage/vdisk/hulldb/base/CMakeLists.darwin.txt1
-rw-r--r--ydb/core/blobstorage/vdisk/hulldb/base/CMakeLists.linux-aarch64.txt1
-rw-r--r--ydb/core/blobstorage/vdisk/hulldb/base/CMakeLists.linux.txt1
-rw-r--r--ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hullstorageratio.h21
-rw-r--r--ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sst.cpp10
-rw-r--r--ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstslice.cpp4
-rw-r--r--ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstslice.h4
-rw-r--r--ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstvec.h8
-rw-r--r--ydb/core/blobstorage/vdisk/protos/events.proto63
-rw-r--r--ydb/core/blobstorage/vdisk/query/query_public.cpp25
-rw-r--r--ydb/core/blobstorage/vdisk/query/query_public.h9
-rw-r--r--ydb/core/blobstorage/vdisk/query/query_statdb.cpp68
-rw-r--r--ydb/core/blobstorage/vdisk/query/query_statdb.h8
-rw-r--r--ydb/core/blobstorage/vdisk/skeleton/blobstorage_monactors.cpp3
-rw-r--r--ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp16
-rw-r--r--ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonerr.h9
-rw-r--r--ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonfront.cpp23
-rw-r--r--ydb/core/viewer/json_blobindexstat.h31
-rw-r--r--ydb/core/viewer/json_handlers_vdisk.cpp2
21 files changed, 315 insertions, 21 deletions
diff --git a/ydb/core/base/blobstorage.h b/ydb/core/base/blobstorage.h
index e5ed8f25f3..b72c2639cc 100644
--- a/ydb/core/base/blobstorage.h
+++ b/ydb/core/base/blobstorage.h
@@ -696,6 +696,7 @@ struct TEvBlobStorage {
EvChunkForget,
EvFormatReencryptionFinish,
EvDetectedPhantomBlobCommitted,
+ EvGetLogoBlobIndexStatRequest,
EvYardInitResult = EvPut + 9 * 512, /// 268 636 672
EvLogResult,
@@ -743,6 +744,7 @@ struct TEvBlobStorage {
EvVDiskStatResponse,
EvGetLogoBlobResponse,
EvChunkForgetResult,
+ EvGetLogoBlobIndexStatResponse,
// internal proxy interface
EvUnusedLocal1 = EvPut + 10 * 512, // Not used. /// 268 637 184
diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_events.h b/ydb/core/blobstorage/vdisk/common/vdisk_events.h
index e017225c5e..6eedc4343d 100644
--- a/ydb/core/blobstorage/vdisk/common/vdisk_events.h
+++ b/ydb/core/blobstorage/vdisk/common/vdisk_events.h
@@ -2982,4 +2982,31 @@ namespace NKikimr {
TEvGetLogoBlobResponse() = default;
};
+ struct TEvGetLogoBlobIndexStatRequest
+ : public TEventPB<TEvGetLogoBlobIndexStatRequest,
+ NKikimrVDisk::GetLogoBlobIndexStatRequest,
+ TEvBlobStorage::EvGetLogoBlobIndexStatRequest>
+ {
+ TEvGetLogoBlobIndexStatRequest() = default;
+ };
+
+ struct TEvGetLogoBlobIndexStatResponse
+ : public TEvVResultBasePB<TEvGetLogoBlobIndexStatResponse,
+ NKikimrVDisk::GetLogoBlobIndexStatResponse,
+ TEvBlobStorage::EvGetLogoBlobIndexStatResponse>
+ {
+ TEvGetLogoBlobIndexStatResponse() = default;
+
+ TEvGetLogoBlobIndexStatResponse(NKikimrProto::EReplyStatus status, const TVDiskID &, const TInstant &now,
+ const ::NMonitoring::TDynamicCounters::TCounterPtr &counterPtr, const NVDiskMon::TLtcHistoPtr &histoPtr)
+ : TEvVResultBasePB(now, counterPtr, histoPtr, TInterconnectChannels::IC_BLOBSTORAGE_SMALL_MSG)
+ {
+ Record.set_status(NKikimrProto::EReplyStatus_Name(status));
+ }
+
+ void SetError() {
+ Record.set_status(NKikimrProto::EReplyStatus_Name(NKikimrProto::ERROR));
+ }
+ };
+
} // NKikimr
diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/CMakeLists.darwin.txt b/ydb/core/blobstorage/vdisk/hulldb/base/CMakeLists.darwin.txt
index 760e6f5156..75c9d7b628 100644
--- a/ydb/core/blobstorage/vdisk/hulldb/base/CMakeLists.darwin.txt
+++ b/ydb/core/blobstorage/vdisk/hulldb/base/CMakeLists.darwin.txt
@@ -15,6 +15,7 @@ target_link_libraries(vdisk-hulldb-base PUBLIC
monlib-service-pages
ydb-core-base
core-blobstorage-pdisk
+ blobstorage-vdisk-protos
)
target_sources(vdisk-hulldb-base PRIVATE
${CMAKE_SOURCE_DIR}/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.cpp
diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/CMakeLists.linux-aarch64.txt b/ydb/core/blobstorage/vdisk/hulldb/base/CMakeLists.linux-aarch64.txt
index 5fc6a726fb..e5495e5d67 100644
--- a/ydb/core/blobstorage/vdisk/hulldb/base/CMakeLists.linux-aarch64.txt
+++ b/ydb/core/blobstorage/vdisk/hulldb/base/CMakeLists.linux-aarch64.txt
@@ -16,6 +16,7 @@ target_link_libraries(vdisk-hulldb-base PUBLIC
monlib-service-pages
ydb-core-base
core-blobstorage-pdisk
+ blobstorage-vdisk-protos
)
target_sources(vdisk-hulldb-base PRIVATE
${CMAKE_SOURCE_DIR}/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.cpp
diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/CMakeLists.linux.txt b/ydb/core/blobstorage/vdisk/hulldb/base/CMakeLists.linux.txt
index 5fc6a726fb..e5495e5d67 100644
--- a/ydb/core/blobstorage/vdisk/hulldb/base/CMakeLists.linux.txt
+++ b/ydb/core/blobstorage/vdisk/hulldb/base/CMakeLists.linux.txt
@@ -16,6 +16,7 @@ target_link_libraries(vdisk-hulldb-base PUBLIC
monlib-service-pages
ydb-core-base
core-blobstorage-pdisk
+ blobstorage-vdisk-protos
)
target_sources(vdisk-hulldb-base PRIVATE
${CMAKE_SOURCE_DIR}/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.cpp
diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hullstorageratio.h b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hullstorageratio.h
index 5d8f3fa51d..2257b2f189 100644
--- a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hullstorageratio.h
+++ b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hullstorageratio.h
@@ -1,6 +1,7 @@
#pragma once
#include "defs.h"
+#include <ydb/core/blobstorage/vdisk/protos/events.pb.h>
namespace NKikimr {
namespace NHullComp {
@@ -68,6 +69,19 @@ namespace NKikimr {
<< "}";
}
+ void OutputProto(NKikimrVDisk::StorageRatio* proto) const {
+ if (proto) {
+ proto->set_index_items_keep(IndexItemsKeep);
+ proto->set_index_items_total(IndexItemsTotal);
+ proto->set_index_bytes_keep(IndexBytesKeep);
+ proto->set_index_bytes_total(IndexBytesTotal);
+ proto->set_inplace_bytes_keep(InplacedDataKeep);
+ proto->set_inplace_bytes_total(InplacedDataTotal);
+ proto->set_huge_bytes_keep(HugeDataKeep);
+ proto->set_huge_bytes_total(HugeDataTotal);
+ }
+ }
+
TString ToString() const {
TStringStream str;
Output(str);
@@ -123,6 +137,13 @@ namespace NKikimr {
return Ratio;
}
+ void OutputProto(NKikimrVDisk::StorageRatio* proto) const {
+ TSstRatioPtr ratio = Get();
+ if (ratio) {
+ ratio->OutputProto(proto);
+ }
+ }
+
TString MonSummary() const {
TSstRatioPtr ratio = Get();
return ratio ? ratio->MonSummary() : "UNK";
diff --git a/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sst.cpp b/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sst.cpp
index 0f6dba6748..85583f5548 100644
--- a/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sst.cpp
+++ b/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sst.cpp
@@ -39,6 +39,16 @@ namespace NKikimr {
row->set_idx_total_size(Info.IdxTotalSize);
row->set_inplace_data_total_size(Info.InplaceDataTotalSize);
row->set_huge_data_total_size(Info.HugeDataTotalSize);
+ row->set_chunks(Info.Chunks);
+ row->set_total_chunks(Info.IndexParts);
+ row->set_items(Info.Items);
+ row->set_items_with_inplaced_data(Info.ItemsWithInplacedData);
+ row->set_items_with_huge_data(Info.ItemsWithHugeData);
+ row->set_first_key(FirstKey().ToString());
+ row->set_last_key(LastKey().ToString());
+ StorageRatio.OutputProto(row->mutable_storage_ratio());
+ row->set_is_created_by_repl(Info.IsCreatedByRepl());
+ row->set_time(ToStringLocalTimeUpToSeconds(Info.CTime));
}
}
diff --git a/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstslice.cpp b/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstslice.cpp
index 1792bd77dd..6ffe1a4902 100644
--- a/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstslice.cpp
+++ b/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstslice.cpp
@@ -58,6 +58,10 @@ namespace NKikimr {
template <class TKey, class TMemRec>
void TLevelSlice<TKey, TMemRec>::OutputProto(google::protobuf::RepeatedPtrField<NKikimrVDisk::LevelStat> *rows) const {
+
+ if (!Level0.Empty()) {
+ Level0.OutputProto(rows);
+ }
ui32 level = 1;
for (const auto &x : SortedLevels) {
if (!x.Empty()) {
diff --git a/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstslice.h b/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstslice.h
index e30e08544c..864462766c 100644
--- a/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstslice.h
+++ b/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstslice.h
@@ -92,6 +92,10 @@ namespace NKikimr {
Segs->OutputHtml(index, str, sum);
}
+ void OutputProto(google::protobuf::RepeatedPtrField<NKikimrVDisk::LevelStat> *rows) const {
+ Segs->OutputProto(rows);
+ }
+
typename TUnorderedLevelSegments::TSstIterator GetSstIterator(ui32 numLimit) const {
return typename TUnorderedLevelSegments::TSstIterator(Segs.Get(), numLimit);
}
diff --git a/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstvec.h b/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstvec.h
index a5f58bebcf..920628f2d1 100644
--- a/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstvec.h
+++ b/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstvec.h
@@ -262,6 +262,14 @@ namespace NKikimr {
}
}
+ void OutputProto(google::protobuf::RepeatedPtrField<NKikimrVDisk::LevelStat> *rows) const {
+ for (const auto &x : Segments) {
+ if (x) {
+ x->OutputProto(0, rows);
+ }
+ }
+ }
+
void GetOwnedChunks(TSet<TChunkIdx>& chunks) const {
for (const TLevelSegmentPtr& seg : Segments) {
seg->GetOwnedChunks(chunks);
diff --git a/ydb/core/blobstorage/vdisk/protos/events.proto b/ydb/core/blobstorage/vdisk/protos/events.proto
index 7621b641d7..78a70268bc 100644
--- a/ydb/core/blobstorage/vdisk/protos/events.proto
+++ b/ydb/core/blobstorage/vdisk/protos/events.proto
@@ -7,23 +7,34 @@ option java_outer_classname = "VDiskProtos";
option java_multiple_files = true;
+message StorageRatio {
+ uint64 index_items_keep = 1;
+ uint64 index_items_total = 2;
+ uint64 index_bytes_keep = 3;
+ uint64 index_bytes_total = 4;
+ uint64 inplace_bytes_keep = 5;
+ uint64 inplace_bytes_total = 6;
+ uint64 huge_bytes_keep = 7;
+ uint64 huge_bytes_total = 8;
+}
+
message LevelStat {
uint32 level = 1;
- uint32 first_lsn = 2;
- uint32 last_lsn = 3;
- uint32 idx_total_size = 4;
- uint32 inplace_data_total_size = 5;
- uint32 huge_data_total_size = 6;
- uint32 chunks = 7;
- uint32 total_chunks = 8;
- uint32 items = 9;
- uint32 items_with_inplaced_data = 10;
- uint32 items_with_huge_data = 11;
+ uint64 first_lsn = 2;
+ uint64 last_lsn = 3;
+ uint64 idx_total_size = 4;
+ uint64 inplace_data_total_size = 5;
+ uint64 huge_data_total_size = 6;
+ uint64 chunks = 7;
+ uint64 total_chunks = 8;
+ uint64 items = 9;
+ uint64 items_with_inplaced_data = 10;
+ uint64 items_with_huge_data = 11;
bytes first_key = 12;
bytes last_key = 13;
- uint32 storage_ratio_summary = 14;
+ StorageRatio storage_ratio = 14;
bool is_created_by_repl = 15;
- uint64 time = 16;
+ string time = 16;
};
@@ -102,10 +113,36 @@ message GetLogoBlobRequest {
message GetLogoBlobResponse {
message LogoBlob {
string status = 1;
- optional uint64 ingress = 2;
+ optional string ingress = 2;
string id = 3;
};
repeated LogoBlob logoblobs = 1;
string error_msg = 2;
};
+
+message GetLogoBlobIndexStatRequest {
+
+}
+
+message ChannelInfo {
+ uint64 count = 1;
+ uint64 data_size = 2;
+ string min_id = 3;
+ string max_id = 4;
+}
+
+message TabletInfo {
+ uint64 tablet_id = 1;
+ repeated ChannelInfo channels = 2;
+}
+
+message LogoBlobIndexStat {
+ repeated TabletInfo tablets = 1;
+ repeated ChannelInfo channels = 2;
+}
+
+message GetLogoBlobIndexStatResponse {
+ string status = 1;
+ LogoBlobIndexStat stat = 2;
+}
diff --git a/ydb/core/blobstorage/vdisk/query/query_public.cpp b/ydb/core/blobstorage/vdisk/query/query_public.cpp
index db91316a88..d4a9728e6b 100644
--- a/ydb/core/blobstorage/vdisk/query/query_public.cpp
+++ b/ydb/core/blobstorage/vdisk/query/query_public.cpp
@@ -187,6 +187,19 @@ namespace NKikimr {
}
}
+ template <class TKey, class TMemRec>
+ static inline IActor *RunDbStatAction(
+ const TIntrusivePtr<THullCtx> &hullCtx,
+ const TActorContext &,
+ TLevelIndexSnapshot<TKey, TMemRec> &&levelSnap,
+ const TActorId &parentId,
+ TEvGetLogoBlobIndexStatRequest::TPtr &ev,
+ std::unique_ptr<TEvGetLogoBlobIndexStatResponse> result)
+ {
+ using TStatActorEx = TLevelIndexStatActor<TKey, TMemRec,
+ TEvGetLogoBlobIndexStatRequest, TEvGetLogoBlobIndexStatResponse>;
+ return new TStatActorEx(hullCtx, parentId, std::move(levelSnap), ev, std::move(result));
+ }
////////////////////////////////////////////////////////////////////////////
// CreateDbStatActor
@@ -223,6 +236,18 @@ namespace NKikimr {
}
}
+ IActor *CreateDbStatActor(
+ const TIntrusivePtr<THullCtx> &hullCtx,
+ const std::shared_ptr<THugeBlobCtx> &,
+ const TActorContext &ctx,
+ THullDsSnap &&fullSnap,
+ const TActorId &parentId,
+ TEvGetLogoBlobIndexStatRequest::TPtr &ev,
+ std::unique_ptr<TEvGetLogoBlobIndexStatResponse> result)
+ {
+ return RunDbStatAction(hullCtx, ctx, std::move(fullSnap.LogoBlobsSnap), parentId, ev, std::move(result));
+ }
+
IActor *CreateMonStreamActor(THullDsSnap&& fullSnap, TEvBlobStorage::TEvMonStreamQuery::TPtr& ev) {
return new TLevelIndexStreamActor(std::move(fullSnap), ev);
}
diff --git a/ydb/core/blobstorage/vdisk/query/query_public.h b/ydb/core/blobstorage/vdisk/query/query_public.h
index 6367ef107e..a80dd48aa8 100644
--- a/ydb/core/blobstorage/vdisk/query/query_public.h
+++ b/ydb/core/blobstorage/vdisk/query/query_public.h
@@ -85,6 +85,15 @@ namespace NKikimr {
TEvBlobStorage::TEvVDbStat::TPtr &ev,
std::unique_ptr<TEvBlobStorage::TEvVDbStatResult> result);
+ IActor *CreateDbStatActor(
+ const TIntrusivePtr<THullCtx> &hullCtx,
+ const std::shared_ptr<THugeBlobCtx> &hugeBlobCtx,
+ const TActorContext &ctx,
+ THullDsSnap &&fullSnap,
+ const TActorId &parentId,
+ TEvGetLogoBlobIndexStatRequest::TPtr &ev,
+ std::unique_ptr<TEvGetLogoBlobIndexStatResponse> result);
+
IActor *CreateMonStreamActor(THullDsSnap&& fullSnap, TEvBlobStorage::TEvMonStreamQuery::TPtr& ev);
} // NKikimr
diff --git a/ydb/core/blobstorage/vdisk/query/query_statdb.cpp b/ydb/core/blobstorage/vdisk/query/query_statdb.cpp
index 65bded589f..85a2687393 100644
--- a/ydb/core/blobstorage/vdisk/query/query_statdb.cpp
+++ b/ydb/core/blobstorage/vdisk/query/query_statdb.cpp
@@ -62,6 +62,13 @@ namespace NKikimr {
TABLED() {SMALL() {str << MaxId.ToString();}}
}
}
+
+ void Finish(NKikimrVDisk::ChannelInfo *channelInfo) {
+ channelInfo->set_count(Num);
+ channelInfo->set_data_size(DataSize);
+ channelInfo->set_min_id(MinId.ToString());
+ channelInfo->set_max_id(MaxId.ToString());
+ }
};
///////////////////////////////////////////////////////////////////////////////
@@ -100,6 +107,12 @@ namespace NKikimr {
Finish(str, nothing, pretty);
}
+ void Finish(::google::protobuf::RepeatedPtrField<NKikimrVDisk::ChannelInfo> *channelsOutput) {
+ for (auto &c : Channels) {
+ c.Finish(channelsOutput->Add());
+ }
+ }
+
private:
TVector<TChannelInfo> Channels;
@@ -140,6 +153,11 @@ namespace NKikimr {
AllChannels.Finish(str, TabletID, pretty);
}
+ void Finish(NKikimrVDisk::TabletInfo *result) {
+ AllChannels.Finish(result->mutable_channels());
+ result->set_tablet_id(TabletID);
+ }
+
private:
ui64 TabletID;
TAllChannels AllChannels;
@@ -219,6 +237,15 @@ namespace NKikimr {
}
}
}
+
+ void Finish(::google::protobuf::RepeatedPtrField<NKikimrVDisk::TabletInfo> *tabletsOutput,
+ ::google::protobuf::RepeatedPtrField<NKikimrVDisk::ChannelInfo> *channelsOutput)
+ {
+ for (const auto &x : Hash) {
+ x.second->Finish(tabletsOutput->Add());
+ }
+ AllChannels.Finish(channelsOutput);
+ }
};
}
@@ -264,6 +291,47 @@ namespace NKikimr {
}
template <>
+ void TLevelIndexStatActor<TKeyLogoBlob, TMemRecLogoBlob,
+ TEvGetLogoBlobIndexStatRequest, TEvGetLogoBlobIndexStatResponse
+ >::CalculateStat(std::unique_ptr<TEvGetLogoBlobIndexStatResponse> &result) {
+ // aggregation class
+ struct TAggr {
+ using TLevelSegment = ::NKikimr::TLevelSegment<TKeyLogoBlob, TMemRecLogoBlob>;
+ using TLevelSstPtr = typename TLevelSegment::TLevelSstPtr;
+
+ TAggr(std::unique_ptr<TEvGetLogoBlobIndexStatResponse> &result)
+ : Result(result)
+ {}
+
+ void UpdateFresh(const char *segName,
+ const TKeyLogoBlob &key,
+ const TMemRecLogoBlob &memRec) {
+ Y_UNUSED(segName);
+ Tablets.Update(key.LogoBlobID(), memRec);
+ }
+
+ void UpdateLevel(const TLevelSstPtr &sstPtr,
+ const TKeyLogoBlob &key,
+ const TMemRecLogoBlob &memRec) {
+ Y_UNUSED(sstPtr);
+ Tablets.Update(key.LogoBlobID(), memRec);
+ }
+
+ void Finish() {
+ auto stat = Result->Record.mutable_stat();
+ Tablets.Finish(stat->mutable_tablets(), stat->mutable_channels());
+ }
+
+ TAllTablets Tablets;
+ std::unique_ptr<TEvGetLogoBlobIndexStatResponse> &Result;
+ };
+
+ // run aggregation
+ TAggr aggr(result);
+ TraverseDbWithoutMerge(HullCtx, &aggr, Snapshot);
+ }
+
+ template <>
void TLevelIndexStatActor<TKeyBlock, TMemRecBlock>::CalculateStat(IOutputStream &str,
bool pretty) {
// aggregation class
diff --git a/ydb/core/blobstorage/vdisk/query/query_statdb.h b/ydb/core/blobstorage/vdisk/query/query_statdb.h
index cb0dc75296..4dd59f9e1b 100644
--- a/ydb/core/blobstorage/vdisk/query/query_statdb.h
+++ b/ydb/core/blobstorage/vdisk/query/query_statdb.h
@@ -10,9 +10,9 @@ namespace NKikimr {
// TLevelIndexStatActor
////////////////////////////////////////////////////////////////////////////
template <class TKey, class TMemRec, class TRequest = TEvBlobStorage::TEvVDbStat, class TResponse = TEvBlobStorage::TEvVDbStatResult>
- class TLevelIndexStatActor : public TActorBootstrapped<TLevelIndexStatActor<TKey, TMemRec>> {
+ class TLevelIndexStatActor : public TActorBootstrapped<TLevelIndexStatActor<TKey, TMemRec, TRequest, TResponse>> {
- using TThis = ::NKikimr::TLevelIndexStatActor<TKey, TMemRec>;
+ using TThis = ::NKikimr::TLevelIndexStatActor<TKey, TMemRec, TRequest, TResponse>;
using TLevelIndex = ::NKikimr::TLevelIndex<TKey, TMemRec>;
using TLevelIndexSnapshot = ::NKikimr::TLevelIndexSnapshot<TKey, TMemRec>;
using TLevelSliceSnapshot = ::NKikimr::TLevelSliceSnapshot<TKey, TMemRec>;
@@ -25,8 +25,8 @@ namespace NKikimr {
void Bootstrap(const TActorContext &ctx) {
TStringStream str;
- const bool prettyPrint = Ev->Get()->Record.GetPrettyPrint();
- if constexpr (std::is_same_v<TResponse, TEvBlobStorage::TEvVDbStatResult>) {
+ if constexpr (std::is_same_v<TRequest, TEvBlobStorage::TEvVDbStat>) {
+ const bool prettyPrint = Ev->Get()->Record.GetPrettyPrint();
CalculateStat(str, prettyPrint);
Result->SetResult(str.Str());
SendVDiskResponse(ctx, Ev->Sender, Result.release(), Ev->Cookie);
diff --git a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_monactors.cpp b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_monactors.cpp
index 9e524bc55d..0a7ddc3f34 100644
--- a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_monactors.cpp
+++ b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_monactors.cpp
@@ -486,7 +486,8 @@ namespace NKikimr {
blob->set_id(id.ToString());
blob->set_status(NKikimrProto::EReplyStatus_Name(q.GetStatus()));
if (ShowInternals) {
- blob->set_ingress(q.GetIngress());
+ TIngress ingress(q.GetIngress());
+ blob->set_ingress(ingress.ToString(Top.get(), TVDiskIdShort(SelfVDiskId), id));
}
}
diff --git a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp
index 58b5543d5c..33d6a39c24 100644
--- a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp
+++ b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp
@@ -1235,6 +1235,21 @@ namespace NKikimr {
}
}
+ void Handle(TEvGetLogoBlobIndexStatRequest::TPtr &ev, const TActorContext &ctx) {
+ LOG_DEBUG_S(ctx, BS_VDISK_OTHER, VCtx->VDiskLogPrefix << "TEvGetLogoBlobIndexStatRequest"
+ << " Marker# BSVS42");
+
+ auto result = std::make_unique<TEvGetLogoBlobIndexStatResponse>(NKikimrProto::OK, SelfVDiskId, ctx.Now(),
+ nullptr, nullptr);
+ THullDsSnap fullSnap = Hull->GetIndexSnapshot();
+ IActor *actor = CreateDbStatActor(HullCtx, HugeBlobCtx, ctx, std::move(fullSnap),
+ ctx.SelfID, ev, std::move(result));
+ if (actor) {
+ auto aid = ctx.Register(actor);
+ ActiveActors.Insert(aid);
+ }
+ }
+
////////////////////////////////////////////////////////////////////////
// STREAM QUERIES
////////////////////////////////////////////////////////////////////////
@@ -2551,6 +2566,7 @@ namespace NKikimr {
HFunc(TEvBlobStorage::TEvVStatus, Handle)
HFunc(TEvBlobStorage::TEvVAssimilate, Handle)
HFunc(TEvBlobStorage::TEvVDbStat, Handle)
+ HFunc(TEvGetLogoBlobIndexStatRequest, Handle)
HFunc(TEvBlobStorage::TEvMonStreamQuery, Handle)
HFunc(TEvBlobStorage::TEvMonStreamActorDeathNote, Handle)
HFunc(TEvBlobStorage::TEvVCompact, Handle)
diff --git a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonerr.h b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonerr.h
index a653829f9d..35925edc57 100644
--- a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonerr.h
+++ b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonerr.h
@@ -466,6 +466,15 @@ namespace NKikimr {
{
return std::make_unique<TEvBlobStorage::TEvVReleaseSnapshotResult>(status, errorReason, vdiskID);
}
+
+ static inline std::unique_ptr<IEventBase>
+ ErroneousResult(const TVDiskContextPtr& /*vctx*/, const NKikimrProto::EReplyStatus status, const TString& /*errorReason*/,
+ TEvGetLogoBlobIndexStatRequest::TPtr& /*ev*/, const TInstant& now,
+ const TActorIDPtr &/*skeletonFrontIDPtr*/, const TVDiskID &vdiskID, ui64 /*vdiskIncarnationGuid*/,
+ const TIntrusivePtr<TBlobStorageGroupInfo>& /*groupInfo*/)
+ {
+ return std::make_unique<TEvGetLogoBlobIndexStatResponse>(status,vdiskID, now, nullptr, nullptr);
+ }
} // NErrBuilder
} // NKikimr
diff --git a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonfront.cpp b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonfront.cpp
index 4a60be49f3..a9d5dd163d 100644
--- a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonfront.cpp
+++ b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonfront.cpp
@@ -622,11 +622,16 @@ namespace NKikimr {
using TNotificationIDs = TSet<TActorId>;
TNotificationIDs NotificationIDs;
+ template <class TEv, class Decayed = std::decay_t<TEv>>
+ static constexpr bool IsWithoutNotify = std::is_same_v<TEvGetLogoBlobIndexStatRequest, Decayed>;
+
template <class T>
void NotifyIfNotReady(T &ev, const TActorContext &ctx) {
Y_UNUSED(ctx);
- if (ev->Get()->Record.GetNotifyIfNotReady()) {
- NotificationIDs.insert(ev->Sender);
+ if constexpr (!IsWithoutNotify<decltype(*ev->Get())>) {
+ if (ev->Get()->Record.GetNotifyIfNotReady()) {
+ NotificationIDs.insert(ev->Sender);
+ }
}
}
@@ -1573,6 +1578,7 @@ namespace NKikimr {
HFunc(TEvBlobStorage::TEvVStatus, DatabaseNotReadyHandle)
HFunc(TEvBlobStorage::TEvVAssimilate, DatabaseNotReadyHandle)
HFunc(TEvBlobStorage::TEvVDbStat, DatabaseNotReadyHandle)
+ HFunc(TEvGetLogoBlobIndexStatRequest, DatabaseNotReadyHandle)
HFunc(TEvBlobStorage::TEvMonStreamQuery, DatabaseNotReadyHandle)
HFunc(TEvBlobStorage::TEvVSync, DatabaseNotReadyHandle)
HFunc(TEvBlobStorage::TEvVSyncFull, DatabaseNotReadyHandle)
@@ -1617,6 +1623,7 @@ namespace NKikimr {
HFunc(TEvBlobStorage::TEvVStatus, DatabaseNotReadyHandle)
HFunc(TEvBlobStorage::TEvVAssimilate, DatabaseNotReadyHandle)
HFunc(TEvBlobStorage::TEvVDbStat, DatabaseNotReadyHandle)
+ HFunc(TEvGetLogoBlobIndexStatRequest, DatabaseNotReadyHandle)
HFunc(TEvBlobStorage::TEvMonStreamQuery, DatabaseNotReadyHandle)
HFunc(TEvBlobStorage::TEvVSync, DatabaseNotReadyHandle)
HFunc(TEvBlobStorage::TEvVSyncFull, DatabaseNotReadyHandle)
@@ -1664,6 +1671,7 @@ namespace NKikimr {
HFunc(TEvBlobStorage::TEvVStatus, DatabaseErrorHandle)
HFunc(TEvBlobStorage::TEvVAssimilate, DatabaseErrorHandle)
HFunc(TEvBlobStorage::TEvVDbStat, DatabaseErrorHandle)
+ HFunc(TEvGetLogoBlobIndexStatRequest, DatabaseErrorHandle)
HFunc(TEvBlobStorage::TEvMonStreamQuery, DatabaseErrorHandle)
HFunc(TEvBlobStorage::TEvVSync, DatabaseErrorHandle)
HFunc(TEvBlobStorage::TEvVSyncFull, DatabaseErrorHandle)
@@ -1706,6 +1714,7 @@ namespace NKikimr {
template <typename TEv>
static constexpr bool IsWithoutQoS = std::is_same_v<TEv, TEvBlobStorage::TEvVStatus>
|| std::is_same_v<TEv, TEvBlobStorage::TEvVDbStat>
+ || std::is_same_v<TEv, TEvGetLogoBlobIndexStatRequest>
|| std::is_same_v<TEv, TEvBlobStorage::TEvVCompact>
|| std::is_same_v<TEv, TEvBlobStorage::TEvVDefrag>
|| std::is_same_v<TEv, TEvBlobStorage::TEvVBaldSyncLog>
@@ -1737,10 +1746,17 @@ namespace NKikimr {
return true;
}
+ template <class TEv, class Decayed = std::decay_t<TEv>>
+ static constexpr bool IsWithoutVDiskId = std::is_same_v<TEv, Decayed>;
+
template <typename TEventType>
void Check(TAutoPtr<TEventHandle<TEventType>>& ev, const TActorContext& ctx) {
const auto& record = ev->Get()->Record;
- if (!SelfVDiskId.SameDisk(record.GetVDiskID())) {
+ bool isSameVDisk = true;
+ if constexpr (!IsWithoutVDiskId<TEventType>) {
+ isSameVDisk = SelfVDiskId.SameDisk(record.GetVDiskID());
+ }
+ if (!isSameVDisk) {
return Reply(ev, ctx, NKikimrProto::RACE, "group generation mismatch", TAppData::TimeProvider->Now());
} else if (!GInfo->CheckScope(TKikimrScopeId(ev->OriginScopeId), ctx, true)) {
DatabaseAccessDeniedHandle(ev, ctx);
@@ -1785,6 +1801,7 @@ namespace NKikimr {
HFunc(TEvBlobStorage::TEvVStatus, Check)
HFunc(TEvBlobStorage::TEvVAssimilate, Check)
HFunc(TEvBlobStorage::TEvVDbStat, Check)
+ HFunc(TEvGetLogoBlobIndexStatRequest, Check)
HFunc(TEvBlobStorage::TEvMonStreamQuery, HandleRequestWithoutQoS)
HFunc(TEvBlobStorage::TEvVSync, HandleRequestWithoutQoS)
HFunc(TEvBlobStorage::TEvVSyncFull, HandleRequestWithoutQoS)
diff --git a/ydb/core/viewer/json_blobindexstat.h b/ydb/core/viewer/json_blobindexstat.h
new file mode 100644
index 0000000000..848a7984d9
--- /dev/null
+++ b/ydb/core/viewer/json_blobindexstat.h
@@ -0,0 +1,31 @@
+#pragma once
+#include <library/cpp/actors/core/actor_bootstrapped.h>
+#include <library/cpp/actors/core/interconnect.h>
+#include <library/cpp/actors/core/mon.h>
+#include <ydb/core/blobstorage/vdisk/common/vdisk_events.h>
+#include <ydb/core/protos/services.pb.h>
+#include <ydb/core/node_whiteboard/node_whiteboard.h>
+#include <ydb/core/util/tuples.h>
+#include "json_vdisk_req.h"
+
+namespace NKikimr {
+namespace NViewer {
+
+using TJsonBlobIndexStat = TJsonVDiskRequest<TEvGetLogoBlobIndexStatRequest, TEvGetLogoBlobIndexStatResponse>;
+
+template <>
+struct TJsonRequestSummary<TJsonBlobIndexStat> {
+ static TString GetSummary() {
+ return "\"Get logoblob index stat from VDisk\"";
+ }
+};
+
+template <>
+struct TJsonRequestDescription<TJsonBlobIndexStat> {
+ static TString GetDescription() {
+ return "\"Get logoblob index stat from VDisk\"";
+ }
+};
+
+}
+}
diff --git a/ydb/core/viewer/json_handlers_vdisk.cpp b/ydb/core/viewer/json_handlers_vdisk.cpp
index 4684d8a2ff..642414fc90 100644
--- a/ydb/core/viewer/json_handlers_vdisk.cpp
+++ b/ydb/core/viewer/json_handlers_vdisk.cpp
@@ -2,6 +2,7 @@
#include "json_vdiskstat.h"
#include "json_getblob.h"
+#include "json_blobindexstat.h"
namespace NKikimr::NViewer {
@@ -10,6 +11,7 @@ template <>
void TVDiskJsonHandlers::Init() {
JsonHandlers["vdisk/json/vdiskstat"] = new TJsonHandler<TJsonVDiskStat>;
JsonHandlers["vdisk/json/getblob"] = new TJsonHandler<TJsonGetBlob>;
+ JsonHandlers["vdisk/json/blobindexstat"] = new TJsonHandler<TJsonBlobIndexStat>;
}
}