From 9772680d6cb2887b8a21ff8145f7289ea6a96306 Mon Sep 17 00:00:00 2001 From: mregrock Date: Mon, 20 May 2024 16:24:15 +0300 Subject: [PATCH] Small changes --- ydb/core/base/blobstorage.cpp | 18 +- ydb/core/base/blobstorage.h | 42 +-- ydb/core/base/id_wrapper.h | 97 ++++++ ydb/core/blob_depot/agent/agent_impl.h | 1 + ydb/core/blob_depot/agent/proxy.cpp | 2 +- ydb/core/blob_depot/agent/query.cpp | 2 +- ydb/core/blob_depot/agent/storage_get.cpp | 2 +- ydb/core/blob_depot/agent/storage_put.cpp | 2 +- ydb/core/blob_depot/agent/storage_range.cpp | 2 +- ydb/core/blobstorage/backpressure/event.h | 2 +- .../ut_client/backpressure_ut.cpp | 3 +- .../blobstorage/base/blobstorage_vdiskid.cpp | 18 +- .../blobstorage/base/blobstorage_vdiskid.h | 16 +- ydb/core/blobstorage/base/defs.h | 2 +- ydb/core/blobstorage/dsproxy/dsproxy.h | 8 +- .../blobstorage/dsproxy/dsproxy_discover.cpp | 2 +- .../dsproxy/dsproxy_discover_m3dc.cpp | 4 +- ydb/core/blobstorage/dsproxy/dsproxy_get.cpp | 6 +- ydb/core/blobstorage/dsproxy/dsproxy_impl.cpp | 2 +- ydb/core/blobstorage/dsproxy/dsproxy_impl.h | 6 +- ydb/core/blobstorage/dsproxy/dsproxy_mon.cpp | 2 +- .../blobstorage/dsproxy/dsproxy_patch.cpp | 15 +- ydb/core/blobstorage/dsproxy/dsproxy_put.cpp | 6 +- .../blobstorage/dsproxy/dsproxy_put_impl.h | 4 +- .../blobstorage/dsproxy/dsproxy_request.cpp | 4 +- ydb/core/blobstorage/dsproxy/dsproxy_stat.cpp | 2 +- .../blobstorage/dsproxy/dsproxy_state.cpp | 4 +- .../blobstorage/dsproxy/mock/dsproxy_mock.cpp | 7 +- .../blobstorage/dsproxy/mock/dsproxy_mock.h | 4 +- ydb/core/blobstorage/dsproxy/mock/model.h | 8 +- .../dsproxy/ut/dsproxy_patch_ut.cpp | 8 +- .../ut_ftol/dsproxy_fault_tolerance_ut_base.h | 4 +- .../dsproxy_fault_tolerance_ut_discover.h | 6 +- .../ut_ftol/dsproxy_fault_tolerance_ut_get.h | 2 +- .../dsproxy_fault_tolerance_ut_range.h | 2 +- .../dsproxy_fault_tolerance_ut_runtime.h | 2 +- .../groupinfo/blobstorage_groupinfo.cpp | 15 +- .../groupinfo/blobstorage_groupinfo.h | 13 +- .../blobstorage/incrhuge/incrhuge_keeper.cpp | 4 +- .../blobstorage/incrhuge/ut/test_actor_seq.h | 2 +- ydb/core/blobstorage/nodewarden/defs.h | 1 + ydb/core/blobstorage/nodewarden/distconf.h | 4 +- .../nodewarden/distconf_generate.cpp | 6 +- .../nodewarden/distconf_invoke.cpp | 12 +- .../nodewarden/distconf_validate.cpp | 8 +- .../nodewarden/node_warden_group.cpp | 4 +- .../nodewarden/node_warden_group_resolver.cpp | 4 +- .../nodewarden/node_warden_impl.cpp | 6 +- .../blobstorage/nodewarden/node_warden_impl.h | 1 + .../nodewarden/node_warden_proxy.cpp | 2 +- .../nodewarden/node_warden_vdisk.cpp | 2 +- .../pdisk/blobstorage_pdisk_ut_actions.cpp | 2 +- .../pdisk/blobstorage_pdisk_ut_actions.h | 5 +- .../blobstorage/pdisk/mock/pdisk_mock.cpp | 6 +- .../testing/group_overseer/group_overseer.cpp | 2 +- .../ut_blobstorage/assimilation.cpp | 6 +- .../blobstorage/ut_blobstorage/balancing.cpp | 4 +- .../ut_blobstorage/counting_events.cpp | 8 +- .../blobstorage/ut_blobstorage/defrag.cpp | 6 +- .../blobstorage/ut_blobstorage/discover.cpp | 6 +- .../ut_blobstorage/extra_block_checks.cpp | 12 +- ydb/core/blobstorage/ut_blobstorage/get.cpp | 6 +- .../ut_blobstorage/group_reconfiguration.cpp | 17 +- .../ut_blobstorage/index_restore_get.cpp | 4 +- ydb/core/blobstorage/ut_blobstorage/lib/env.h | 9 +- .../lib/node_warden_mock_bsc.cpp | 6 +- .../blobstorage/ut_blobstorage/monitoring.cpp | 4 +- ydb/core/blobstorage/ut_blobstorage/patch.cpp | 16 +- .../ut_blobstorage/read_only_vdisk.cpp | 8 +- ydb/core/blobstorage/ut_blobstorage/scrub.cpp | 2 +- .../blobstorage/ut_blobstorage/scrub_fast.cpp | 4 +- ydb/core/blobstorage/ut_blobstorage/sync.cpp | 6 +- .../blobstorage/ut_blobstorage/ut_helpers.h | 10 +- ydb/core/blobstorage/ut_group/main.cpp | 5 +- .../blobstorage/ut_pdiskfit/lib/basic_test.h | 3 +- ydb/core/blobstorage/ut_vdisk/lib/prepare.cpp | 4 +- .../blobstorage/vdisk/common/vdisk_context.h | 4 +- .../blobstorage/vdisk/common/vdisk_events.h | 9 +- .../vdisk/ingress/blobstorage_ingress_ut.cpp | 47 +-- ydb/core/blobstorage/vdisk/ingress/defs.h | 1 + .../vdisk/repl/blobstorage_hullrepljob.cpp | 2 +- .../blobstorage_replrecoverymachine_ut.cpp | 3 +- .../vdisk/skeleton/blobstorage_skeleton.cpp | 4 +- .../vdisk/skeleton/blobstorage_skeletonerr.h | 12 +- .../skeleton/blobstorage_skeletonfront.cpp | 23 +- .../vdisk/syncer/blobstorage_syncer_data.cpp | 6 +- .../syncer/blobstorage_syncer_dataserdes.h | 277 ++++++++---------- ydb/core/blobstorage/vdisk/syncer/defs.h | 1 + ydb/core/cms/cluster_info.cpp | 9 +- ydb/core/cms/cluster_info_ut.cpp | 2 +- .../keyvalue_storage_read_request.cpp | 4 +- .../keyvalue_storage_read_request_ut.cpp | 4 +- .../keyvalue/keyvalue_storage_request.cpp | 16 +- .../mind/bscontroller/cmds_storage_pool.cpp | 15 +- ydb/core/mind/bscontroller/config.cpp | 20 +- .../mind/bscontroller/config_fit_groups.cpp | 18 +- ydb/core/mind/bscontroller/defs.h | 1 + ydb/core/mind/bscontroller/disk_metrics.cpp | 3 +- ydb/core/mind/bscontroller/get_group.cpp | 6 +- .../mind/bscontroller/group_geometry_info.h | 2 +- ydb/core/mind/bscontroller/group_mapper.cpp | 4 +- ydb/core/mind/bscontroller/group_mapper.h | 2 +- .../mind/bscontroller/group_mapper_ut.cpp | 4 +- .../bscontroller/group_metrics_exchange.cpp | 11 +- ydb/core/mind/bscontroller/impl.h | 8 +- .../mind/bscontroller/load_everything.cpp | 14 +- ydb/core/mind/bscontroller/migrate.cpp | 2 +- ydb/core/mind/bscontroller/monitoring.cpp | 33 ++- .../mind/bscontroller/propose_group_key.cpp | 22 +- ydb/core/mind/bscontroller/register_node.cpp | 16 +- .../bscontroller/request_controller_info.cpp | 4 +- ydb/core/mind/bscontroller/scheme.h | 4 +- ydb/core/mind/bscontroller/select_groups.cpp | 4 +- ydb/core/mind/bscontroller/self_heal.cpp | 10 +- ydb/core/mind/bscontroller/stat_processor.cpp | 4 +- ydb/core/mind/bscontroller/sys_view.cpp | 10 +- ydb/core/mind/bscontroller/types.h | 2 +- .../bscontroller/update_group_latencies.cpp | 4 +- .../bscontroller/update_seen_operational.cpp | 2 +- .../bscontroller/ut_bscontroller/main.cpp | 3 +- ydb/core/mind/bscontroller/ut_selfheal/defs.h | 1 - ydb/core/mind/bscontroller/ut_selfheal/env.h | 3 +- .../ut_selfheal/self_heal_actor_ut.cpp | 3 +- ydb/core/mind/bscontroller/virtual_group.cpp | 68 ++--- ydb/core/mind/table_adapter.h | 36 ++- ydb/core/node_whiteboard/node_whiteboard.h | 2 +- ydb/core/tablet/tablet_req_rebuildhistory.cpp | 10 +- ydb/core/tablet/tablet_req_writelog.cpp | 4 +- ydb/core/tablet_flat/flat_cxx_database.h | 28 +- ydb/core/tablet_flat/flat_ops_compact.h | 2 +- .../columnshard/blobs_action/tier/adapter.cpp | 5 +- .../engines/writer/write_controller.cpp | 2 +- ydb/core/tx/datashard/datashard_ut_order.cpp | 3 +- .../tx/datashard/datashard_ut_volatile.cpp | 5 +- 134 files changed, 787 insertions(+), 599 deletions(-) create mode 100644 ydb/core/base/id_wrapper.h diff --git a/ydb/core/base/blobstorage.cpp b/ydb/core/base/blobstorage.cpp index 2a15283b9574..59bfb48fa560 100644 --- a/ydb/core/base/blobstorage.cpp +++ b/ydb/core/base/blobstorage.cpp @@ -45,14 +45,14 @@ bool operator<(const TPDiskCategory x, const TPDiskCategory y) { } std::unique_ptr TEvBlobStorage::TEvPut::MakeErrorResponse( - NKikimrProto::EReplyStatus status, const TString& errorReason, ui32 groupId) { + NKikimrProto::EReplyStatus status, const TString& errorReason, TGroupId groupId) { auto res = std::make_unique(status, Id, TStorageStatusFlags(), groupId, 0.0f); res->ErrorReason = errorReason; return res; } std::unique_ptr TEvBlobStorage::TEvGet::MakeErrorResponse( - NKikimrProto::EReplyStatus status, const TString& errorReason, ui32 groupId) { + NKikimrProto::EReplyStatus status, const TString& errorReason, TGroupId groupId) { auto res = std::make_unique(status, QuerySize, groupId); for (ui32 i = 0; i < QuerySize; ++i) { const auto& from = Queries[i]; @@ -68,14 +68,14 @@ std::unique_ptr TEvBlobStorage::TEvGet::MakeErrorR } std::unique_ptr TEvBlobStorage::TEvBlock::MakeErrorResponse( - NKikimrProto::EReplyStatus status, const TString& errorReason, ui32 /*groupId*/) { + NKikimrProto::EReplyStatus status, const TString& errorReason, TGroupId /*groupId*/) { auto res = std::make_unique(status); res->ErrorReason = errorReason; return res; } std::unique_ptr TEvBlobStorage::TEvPatch::MakeErrorResponse( - NKikimrProto::EReplyStatus status, const TString& errorReason, ui32 groupId) { + NKikimrProto::EReplyStatus status, const TString& errorReason, TGroupId groupId) { auto res = std::make_unique(status, PatchedId, TStorageStatusFlags(), groupId, 0.0f); res->ErrorReason = errorReason; return res; @@ -89,35 +89,35 @@ std::unique_ptr TEvBlobStorage::TEvInplac } std::unique_ptr TEvBlobStorage::TEvDiscover::MakeErrorResponse( - NKikimrProto::EReplyStatus status, const TString& errorReason, ui32 /*groupId*/) { + NKikimrProto::EReplyStatus status, const TString& errorReason, TGroupId/*groupId*/) { auto res = std::make_unique(status, MinGeneration, 0); res->ErrorReason = errorReason; return res; } std::unique_ptr TEvBlobStorage::TEvRange::MakeErrorResponse( - NKikimrProto::EReplyStatus status, const TString& errorReason, ui32 groupId) { + NKikimrProto::EReplyStatus status, const TString& errorReason, TGroupId groupId) { auto res = std::make_unique(status, From, To, groupId); res->ErrorReason = errorReason; return res; } std::unique_ptr TEvBlobStorage::TEvCollectGarbage::MakeErrorResponse( - NKikimrProto::EReplyStatus status, const TString& errorReason, ui32 /*groupId*/) { + NKikimrProto::EReplyStatus status, const TString& errorReason, TGroupId /*groupId*/) { auto res = std::make_unique(status, TabletId, RecordGeneration, PerGenerationCounter, Channel); res->ErrorReason = errorReason; return res; } std::unique_ptr TEvBlobStorage::TEvStatus::MakeErrorResponse( - NKikimrProto::EReplyStatus status, const TString& errorReason, ui32 /*groupId*/) { + NKikimrProto::EReplyStatus status, const TString& errorReason, TGroupId /*groupId*/) { auto res = std::make_unique(status, TStorageStatusFlags()); res->ErrorReason = errorReason; return res; } std::unique_ptr TEvBlobStorage::TEvAssimilate::MakeErrorResponse( - NKikimrProto::EReplyStatus status, const TString& errorReason, ui32 /*groupId*/) { + NKikimrProto::EReplyStatus status, const TString& errorReason, TGroupId/*groupId*/) { return std::make_unique(status, errorReason); } diff --git a/ydb/core/base/blobstorage.h b/ydb/core/base/blobstorage.h index 012326411cb9..a16ce3d8e632 100644 --- a/ydb/core/base/blobstorage.h +++ b/ydb/core/base/blobstorage.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -102,6 +103,8 @@ enum class EGroupConfigurationType : ui32 { struct TGroupID { TGroupID() = default; TGroupID(const TGroupID&) = default; + TGroupID(const TIdWrapper wrappedId) + : Raw(wrappedId.GetRawId()) {} TGroupID(EGroupConfigurationType configurationType, ui32 dataCenterId, ui32 groupLocalId) { Set(configurationType, dataCenterId, groupLocalId); @@ -886,6 +889,8 @@ struct TEvBlobStorage { struct TEvInplacePatchResult; struct TEvAssimilateResult; + using TGroupId = TIdWrapper; + struct TEvPut : public TEventLocal { enum ETactic { TacticMaxThroughput = 0, @@ -905,7 +910,6 @@ struct TEvBlobStorage { return "unknown"; } }; - const TLogoBlobID Id; const TRcBuf Buffer; //FIXME(innokentii) const members prevent usage of move-semantics elsewhere const TInstant Deadline; @@ -975,14 +979,14 @@ struct TEvBlobStorage { } std::unique_ptr MakeErrorResponse(NKikimrProto::EReplyStatus status, const TString& errorReason, - ui32 groupId); + TGroupId groupId); }; struct TEvPutResult : public TEventLocal { NKikimrProto::EReplyStatus Status; const TLogoBlobID Id; const TStorageStatusFlags StatusFlags; - const ui32 GroupId; + const TGroupId GroupId; const float ApproximateFreeSpaceShare; // 0.f has special meaning 'data could not be obtained' TString ErrorReason; bool WrittenBeyondBarrier = false; // was this blob written beyond the barrier? @@ -991,7 +995,7 @@ struct TEvBlobStorage { const TString StorageId; TEvPutResult(NKikimrProto::EReplyStatus status, const TLogoBlobID &id, const TStorageStatusFlags statusFlags, - ui32 groupId, float approximateFreeSpaceShare, const TString& storageId = Default()) + TGroupId groupId, float approximateFreeSpaceShare, const TString& storageId = Default()) : Status(status) , Id(id) , StatusFlags(statusFlags) @@ -1168,7 +1172,7 @@ struct TEvBlobStorage { } std::unique_ptr MakeErrorResponse(NKikimrProto::EReplyStatus status, const TString& errorReason, - ui32 groupId); + TGroupId groupId); private: void VerifySameTabletId() const { @@ -1212,7 +1216,7 @@ struct TEvBlobStorage { // todo: replace with queue-like thing ui32 ResponseSz; TArrayHolder Responses; - const ui32 GroupId; + const TGroupId GroupId; ui32 BlockedGeneration = 0; // valid only for requests with non-zero TabletId and true AcquireBlockedGeneration. TString DebugInfo; TString ErrorReason; @@ -1222,7 +1226,7 @@ struct TEvBlobStorage { // to measure blobstorage->client hop TInstant Sent; - TEvGetResult(NKikimrProto::EReplyStatus status, ui32 sz, ui32 groupId) + TEvGetResult(NKikimrProto::EReplyStatus status, ui32 sz, TGroupId groupId) : Status(status) , ResponseSz(sz) , Responses(sz == 0 ? nullptr : new TResponse[sz]) @@ -1314,7 +1318,7 @@ struct TEvBlobStorage { } std::unique_ptr MakeErrorResponse(NKikimrProto::EReplyStatus status, const TString& errorReason, - ui32 groupId); + TGroupId groupId); }; struct TEvBlockResult : public TEventLocal { @@ -1511,21 +1515,21 @@ struct TEvBlobStorage { } std::unique_ptr MakeErrorResponse(NKikimrProto::EReplyStatus status, - const TString& errorReason, ui32 groupId); + const TString& errorReason, TGroupId groupId); }; struct TEvPatchResult : public TEventLocal { NKikimrProto::EReplyStatus Status; const TLogoBlobID Id; const TStorageStatusFlags StatusFlags; - const ui32 GroupId; + const TGroupId GroupId; const float ApproximateFreeSpaceShare; // 0.f has special meaning 'data could not be obtained' TString ErrorReason; mutable NLWTrace::TOrbit Orbit; std::shared_ptr ExecutionRelay; TEvPatchResult(NKikimrProto::EReplyStatus status, const TLogoBlobID &id, TStorageStatusFlags statusFlags, - ui32 groupId, float approximateFreeSpaceShare) + TGroupId groupId, float approximateFreeSpaceShare) : Status(status) , Id(id) , StatusFlags(statusFlags) @@ -1688,7 +1692,7 @@ struct TEvBlobStorage { } std::unique_ptr MakeErrorResponse(NKikimrProto::EReplyStatus status, const TString& errorReason, - ui32 groupId); + TGroupId groupId); }; struct TEvDiscoverResult : public TEventLocal { @@ -1793,7 +1797,7 @@ struct TEvBlobStorage { } std::unique_ptr MakeErrorResponse(NKikimrProto::EReplyStatus status, const TString& errorReason, - ui32 groupId); + TGroupId groupId); }; struct TEvRangeResult : public TEventLocal { @@ -1817,13 +1821,13 @@ struct TEvBlobStorage { NKikimrProto::EReplyStatus Status; TLogoBlobID From; TLogoBlobID To; - + TVector Responses; - const ui32 GroupId; + const TGroupId GroupId; TString ErrorReason; std::shared_ptr ExecutionRelay; - TEvRangeResult(NKikimrProto::EReplyStatus status, const TLogoBlobID &from, const TLogoBlobID &to, ui32 groupId) + TEvRangeResult(NKikimrProto::EReplyStatus status, const TLogoBlobID &from, const TLogoBlobID &to, TGroupId groupId) : Status(status) , From(from) , To(to) @@ -1981,7 +1985,7 @@ struct TEvBlobStorage { } std::unique_ptr MakeErrorResponse(NKikimrProto::EReplyStatus status, const TString& errorReason, - ui32 groupId); + TGroupId groupId); }; struct TEvCollectGarbageResult : public TEventLocal { @@ -2049,7 +2053,7 @@ struct TEvBlobStorage { } std::unique_ptr MakeErrorResponse(NKikimrProto::EReplyStatus status, const TString& errorReason, - ui32 groupId); + TGroupId groupId); }; struct TEvStatusResult : public TEventLocal { @@ -2124,7 +2128,7 @@ struct TEvBlobStorage { } std::unique_ptr MakeErrorResponse(NKikimrProto::EReplyStatus status, const TString& errorReason, - ui32 groupId); + TGroupId groupId); }; struct TEvAssimilateResult : TEventLocal { diff --git a/ydb/core/base/id_wrapper.h b/ydb/core/base/id_wrapper.h new file mode 100644 index 000000000000..13037f4c811e --- /dev/null +++ b/ydb/core/base/id_wrapper.h @@ -0,0 +1,97 @@ +#pragma once +#include "defs.h" +#include +#include +#include +#include +using TString = TBasicString; + +class TGroupIdTag; + +template class TIdWrapper { +private: + T Raw = {}; + +public: + using Type = T; + using TTag = Tag; + + constexpr TIdWrapper() noexcept {} + + TIdWrapper(TIdWrapper &&value) = default; + + TIdWrapper(const TIdWrapper &other) = default; + + TIdWrapper &operator=(const TIdWrapper &value) = default; + + TIdWrapper &operator=(TIdWrapper &&value) = default; + + TString ToString() const { + return TStringBuilder() << Raw; + } + + void CopyToProto(NProtoBuf::Message *message, void (NProtoBuf::Message::*pfn)(T value)) { + (message->*pfn)(*this); + } + + static constexpr TIdWrapper FromValue(T value) noexcept { + TIdWrapper id; + id.Raw = value; + return id; + } + + template + static constexpr TIdWrapper FromProto(const TType *message, TProto (TType::*pfn)() const){ + return FromValue((message->*pfn)()); + } + + static constexpr TIdWrapper Zero() noexcept { return TIdWrapper(); } + + TIdWrapper &operator+=(const T &other) { + Raw += other.Raw; + return *this; + } + + friend TIdWrapper operator+(const TIdWrapper &first, + const T &second) Y_WARN_UNUSED_RESULT { + return TIdWrapper(first->Raw + second); + } + + TIdWrapper &operator++() { + Raw++; + return *this; + } + + TIdWrapper operator++(int) { + TIdWrapper old = *this; + operator++(); + return old; + } + + friend std::ostream &operator<<(std::ostream &out, TIdWrapper &id) { + return out << id.Raw; + } + + friend IOutputStream& operator<<(IOutputStream& out, const TIdWrapper& id) { + return out << id.Raw; +} + + constexpr auto operator<=>(const TIdWrapper &) const = default; + + T GetRawId() const { return Raw; } + + friend std::hash>; + friend THash>; +}; + +template struct std::hash> { + std::size_t operator()(const TIdWrapper &id) const { + return std::hash{}(id.Raw); + } +}; + +template struct THash> { + std::size_t operator()(const TIdWrapper &id) const { + return THash()(id.Raw); + } +}; diff --git a/ydb/core/blob_depot/agent/agent_impl.h b/ydb/core/blob_depot/agent/agent_impl.h index dc267c84c19c..bac25b43f922 100644 --- a/ydb/core/blob_depot/agent/agent_impl.h +++ b/ydb/core/blob_depot/agent/agent_impl.h @@ -4,6 +4,7 @@ #include "resolved_value.h" #include +#include namespace NKikimr::NBlobDepot { diff --git a/ydb/core/blob_depot/agent/proxy.cpp b/ydb/core/blob_depot/agent/proxy.cpp index 740885a42ea6..ed60e3487c06 100644 --- a/ydb/core/blob_depot/agent/proxy.cpp +++ b/ydb/core/blob_depot/agent/proxy.cpp @@ -32,7 +32,7 @@ namespace NKikimr::NBlobDepot { switch (const ui32 type = event->Type()) { case TEvBlobStorage::EvGet: { auto& get = static_cast(*event); - response = get.MakeErrorResponse(NKikimrProto::OK, "proxy has vanished", groupId); + response = get.MakeErrorResponse(NKikimrProto::OK, "proxy has vanished", TIdWrapper::FromValue(groupId)); auto& r = static_cast(*response); for (size_t i = 0; i < r.ResponseSz; ++i) { r.Responses[i].Status = NKikimrProto::NODATA; diff --git a/ydb/core/blob_depot/agent/query.cpp b/ydb/core/blob_depot/agent/query.cpp index 00e7337f9223..b7a292cee01b 100644 --- a/ydb/core/blob_depot/agent/query.cpp +++ b/ydb/core/blob_depot/agent/query.cpp @@ -177,7 +177,7 @@ namespace NKikimr::NBlobDepot { switch (Event->GetTypeRewrite()) { #define XX(TYPE) \ case TEvBlobStorage::TYPE: \ - response = Event->Get()->MakeErrorResponse(status, errorReason, Agent.VirtualGroupId); \ + response = Event->Get()->MakeErrorResponse(status, errorReason, TIdWrapper::FromValue(Agent.VirtualGroupId)); \ static_cast(*response).ExecutionRelay = std::move(ExecutionRelay); \ break; \ // diff --git a/ydb/core/blob_depot/agent/storage_get.cpp b/ydb/core/blob_depot/agent/storage_get.cpp index b3e6d8c03412..9cf0c78d0d1a 100644 --- a/ydb/core/blob_depot/agent/storage_get.cpp +++ b/ydb/core/blob_depot/agent/storage_get.cpp @@ -31,7 +31,7 @@ namespace NKikimr::NBlobDepot { } Response = std::make_unique(NKikimrProto::OK, Request.QuerySize, - Agent.VirtualGroupId); + TIdWrapper::FromValue(Agent.VirtualGroupId)); AnswersRemain = Request.QuerySize; if (Request.ReaderTabletData) { diff --git a/ydb/core/blob_depot/agent/storage_put.cpp b/ydb/core/blob_depot/agent/storage_put.cpp index 4f2c045f9a6a..bfddc33aea7c 100644 --- a/ydb/core/blob_depot/agent/storage_put.cpp +++ b/ydb/core/blob_depot/agent/storage_put.cpp @@ -284,7 +284,7 @@ namespace NKikimr::NBlobDepot { Y_ABORT_UNLESS(!WrittenBeyondBarrier); TBlobStorageQuery::EndWithSuccess(std::make_unique(NKikimrProto::OK, Request.Id, - Agent.GetStorageStatusFlags(), Agent.VirtualGroupId, Agent.GetApproximateFreeSpaceShare())); + Agent.GetStorageStatusFlags(), TIdWrapper::FromValue(Agent.VirtualGroupId), Agent.GetApproximateFreeSpaceShare())); } ui64 GetTabletId() const override { diff --git a/ydb/core/blob_depot/agent/storage_range.cpp b/ydb/core/blob_depot/agent/storage_range.cpp index e6dcbb5189d0..a6c083b29e91 100644 --- a/ydb/core/blob_depot/agent/storage_range.cpp +++ b/ydb/core/blob_depot/agent/storage_range.cpp @@ -24,7 +24,7 @@ namespace NKikimr::NBlobDepot { (U.MustRestoreFirst, Request.MustRestoreFirst), (U.IndexOnly, Request.IsIndexOnly)); Response = std::make_unique(NKikimrProto::OK, Request.From, Request.To, - Agent.VirtualGroupId); + TIdWrapper::FromValue(Agent.VirtualGroupId)); // issue resolve query TString from = Request.From.AsBinaryString(); diff --git a/ydb/core/blobstorage/backpressure/event.h b/ydb/core/blobstorage/backpressure/event.h index 651e83b6259b..0c77f3c4a188 100644 --- a/ydb/core/blobstorage/backpressure/event.h +++ b/ydb/core/blobstorage/backpressure/event.h @@ -67,7 +67,7 @@ class TEventHolder { const auto& record = ev->Get()->Record; TLogoBlobID blob = LogoBlobIDFromLogoBlobID(record.GetBlobID()); TVDiskID vDiskId = VDiskIDFromVDiskID(record.GetVDiskID()); - LWTRACK(DSQueueVPutIsQueued, Orbit, vDiskId.GroupID, blob.ToString(), blob.Channel(), blob.PartId(), + LWTRACK(DSQueueVPutIsQueued, Orbit, vDiskId.GroupID.GetRawId(), blob.ToString(), blob.Channel(), blob.PartId(), blob.BlobSize()); } diff --git a/ydb/core/blobstorage/backpressure/ut_client/backpressure_ut.cpp b/ydb/core/blobstorage/backpressure/ut_client/backpressure_ut.cpp index 3c92342241c1..90a16e297d0d 100644 --- a/ydb/core/blobstorage/backpressure/ut_client/backpressure_ut.cpp +++ b/ydb/core/blobstorage/backpressure/ut_client/backpressure_ut.cpp @@ -1,4 +1,5 @@ #include +#include #include "skeleton_front_mock.h" #include "loader.h" @@ -10,7 +11,7 @@ Y_UNIT_TEST_SUITE(Backpressure) { TTestActorSystem runtime(1); runtime.Start(); - const TVDiskID vdiskId(0, 1, 0, 0, 0); + const TVDiskID vdiskId(TIdWrapper::Zero(), 1, 0, 0, 0); TActorId vdiskActorId = runtime.Register(new TSkeletonFrontMockActor, TActorId(), 0, std::nullopt, 1); std::vector clients; diff --git a/ydb/core/blobstorage/base/blobstorage_vdiskid.cpp b/ydb/core/blobstorage/base/blobstorage_vdiskid.cpp index 07f85e876260..c4dcb363136d 100644 --- a/ydb/core/blobstorage/base/blobstorage_vdiskid.cpp +++ b/ydb/core/blobstorage/base/blobstorage_vdiskid.cpp @@ -1,17 +1,25 @@ #include "blobstorage_vdiskid.h" #include #include +#include namespace NKikimr { //////////////////////////////////////////////////////////////////////////// // TVDiskID //////////////////////////////////////////////////////////////////////////// - const TVDiskID TVDiskID::InvalidId = TVDiskID((ui32)-1, (ui32)-1, (ui8)-1, (ui8)-1, (ui8)-1); + const TVDiskID TVDiskID::InvalidId = TVDiskID(TGroupId::FromValue(-1), (ui32)-1, (ui8)-1, (ui8)-1, (ui8)-1); + TVDiskID::TVDiskID(TGroupId groupId, ui32 groupGen, TVDiskIdShort vdiskIdShort) + : GroupID(groupId) + , GroupGeneration(groupGen) + , FailRealm(vdiskIdShort.FailRealm) + , FailDomain(vdiskIdShort.FailDomain) + , VDisk(vdiskIdShort.VDisk) + {} TVDiskID::TVDiskID(ui32 groupId, ui32 groupGen, TVDiskIdShort vdiskIdShort) - : GroupID(groupId) + : GroupID(TGroupId::FromValue(groupId)) , GroupGeneration(groupGen) , FailRealm(vdiskIdShort.FailRealm) , FailDomain(vdiskIdShort.FailDomain) @@ -24,7 +32,7 @@ namespace NKikimr { } bool TVDiskID::SameGroupAndGeneration(const NKikimrBlobStorage::TVDiskID &x) const { - return x.GetGroupID() == GroupID && x.GetGroupGeneration() == GroupGeneration; + return TGroupId::FromProto(&x, &NKikimrBlobStorage::TVDiskID::GetGroupID) == GroupID && x.GetGroupGeneration() == GroupGeneration; } bool TVDiskID::SameDisk(const NKikimrBlobStorage::TVDiskID &x) const { @@ -34,12 +42,12 @@ namespace NKikimr { TString TVDiskID::ToString() const { return Sprintf("[%" PRIx32 ":%" PRIu32 ":%" PRIu8 ":%" PRIu8 ":%" PRIu8 "]", - GroupID, GroupGeneration, FailRealm, FailDomain, VDisk).data(); + GroupID.GetRawId(), GroupGeneration, FailRealm, FailDomain, VDisk).data(); } TString TVDiskID::ToStringWOGeneration() const { return Sprintf("[%" PRIx32 ":_:%" PRIu8 ":%" PRIu8 ":%" PRIu8 "]", - GroupID, FailRealm, FailDomain, VDisk).data(); + GroupID.GetRawId(), FailRealm, FailDomain, VDisk).data(); } void TVDiskID::Serialize(IOutputStream &s) const { diff --git a/ydb/core/blobstorage/base/blobstorage_vdiskid.h b/ydb/core/blobstorage/base/blobstorage_vdiskid.h index 16a0c535943c..863ce135908e 100644 --- a/ydb/core/blobstorage/base/blobstorage_vdiskid.h +++ b/ydb/core/blobstorage/base/blobstorage_vdiskid.h @@ -1,7 +1,6 @@ #pragma once #include "defs.h" - #include #include @@ -19,7 +18,8 @@ struct TVDiskIdShort; //////////////////////////////////////////////////////////////////////////// #pragma pack(push, 4) struct TVDiskID { - ui32 GroupID = 0; + using TGroupId = TIdWrapper; + TGroupId GroupID = TGroupId::Zero(); ui32 GroupGeneration = 0; ui8 FailRealm = 0; ui8 FailDomain = 0; @@ -27,16 +27,24 @@ struct TVDiskID { ui8 Padding = 0; TVDiskID() = default; + TVDiskID(TGroupId groupId, ui32 groupGen, TVDiskIdShort vdiskIdShort); TVDiskID(ui32 groupId, ui32 groupGen, TVDiskIdShort vdiskIdShort); TVDiskID(IInputStream &str); - TVDiskID(ui32 groupId, ui32 groupGen, ui8 failRealm, ui8 failDomain, ui8 vdisk) + TVDiskID(TGroupId groupId, ui32 groupGen, ui8 failRealm, ui8 failDomain, ui8 vdisk) : GroupID(groupId) , GroupGeneration(groupGen) , FailRealm(failRealm) , FailDomain(failDomain) , VDisk(vdisk) {} + TVDiskID(ui32 groupId, ui32 groupGen, ui8 failRealm, ui8 failDomain, ui8 vdisk) + : GroupID(TGroupId::FromValue(groupId)) + , GroupGeneration(groupGen) + , FailRealm(failRealm) + , FailDomain(failDomain) + , VDisk(vdisk) + {} bool SameGroupAndGeneration(const TVDiskID &x) const { return x.GroupID == GroupID && x.GroupGeneration == GroupGeneration; @@ -69,7 +77,7 @@ struct TVDiskID { ui64 Hash() const { ui32 x = (((ui32(FailRealm) << 8) | ui32(FailDomain)) << 8) | ui32(VDisk); - ui64 y = GroupID; + ui64 y = GroupID.GetRawId(); y = y << 32ull; y |= GroupGeneration; return CombineHashes(IntHash(y), IntHash(x)); diff --git a/ydb/core/blobstorage/base/defs.h b/ydb/core/blobstorage/base/defs.h index fbcc9386982c..c58e6d0bf8f0 100644 --- a/ydb/core/blobstorage/base/defs.h +++ b/ydb/core/blobstorage/base/defs.h @@ -1,4 +1,4 @@ #pragma once // unique tag to fix pragma once gcc glueing: ./ydb/core/blobstorage/base/defs.h #include - +#include diff --git a/ydb/core/blobstorage/dsproxy/dsproxy.h b/ydb/core/blobstorage/dsproxy/dsproxy.h index 0b74ec7c03fe..a85873040550 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy.h +++ b/ydb/core/blobstorage/dsproxy/dsproxy.h @@ -188,7 +188,7 @@ class TBlobStorageGroupRequestActor : public TActor { { TDerived::ActiveCounter(Mon)->Inc(); Span - .Attribute("GroupId", Info->GroupID) + .Attribute("GroupId", Info->GroupID.GetRawId()) .Attribute("RestartCounter", RestartCounter); Y_ABORT_UNLESS(CostModel); @@ -296,7 +296,7 @@ class TBlobStorageGroupRequestActor : public TActor { std::optional group; if (record.HasRecentGroup()) { group = record.GetRecentGroup(); - if (group->GetGroupID() != Info->GroupID || group->GetGroupGeneration() != vdiskId.GroupGeneration) { + if (group->GetGroupID() != Info->GroupID.GetRawId() || group->GetGroupGeneration() != vdiskId.GroupGeneration) { return done(NKikimrProto::ERROR, "incorrect RecentGroup for RACE response"); } } @@ -311,7 +311,7 @@ class TBlobStorageGroupRequestActor : public TActor { SetExecutionRelay(*q, std::exchange(ExecutionRelay, {})); } ++*Mon->NodeMon->RestartHisto[Min(Mon->NodeMon->RestartHisto.size() - 1, RestartCounter)]; - const TActorId& proxyId = MakeBlobStorageProxyID(Info->GroupID); + const TActorId& proxyId = MakeBlobStorageProxyID(Info->GroupID.GetRawId()); TActivationContext::Send(new IEventHandle(nodeWardenId, Source, q.release(), 0, Cookie, &proxyId, Span.GetTraceId())); PassAway(); return true; @@ -448,7 +448,7 @@ class TBlobStorageGroupRequestActor : public TActor { TLogoBlobID id = GetBlobId(request); TVDiskID vDiskId = VDiskIDFromVDiskID(request->Record.GetVDiskID()); LWTRACK(DSProxyPutVPutIsSent, request->Orbit, Info->GetFailDomainOrderNumber(vDiskId), - Info->GroupID, id.Channel(), id.PartId(), id.ToString(), id.BlobSize()); + Info->GroupID.GetRawId(), id.Channel(), id.PartId(), id.ToString(), id.BlobSize()); SendToQueue(std::move(request), messageCookie, timeStatsEnabled); } } diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_discover.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_discover.cpp index e93b4bbeb122..72624aba6c49 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_discover.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_discover.cpp @@ -299,7 +299,7 @@ class TBlobStorageGroupDiscoverRequest : public TBlobStorageGroupRequestActorCountDiscoverResponseTime(duration); const bool success = result->Status == NKikimrProto::OK; LWPROBE(DSProxyRequestDuration, TEvBlobStorage::EvDiscover, 0, duration.SecondsFloat() * 1000.0, - TabletId, Info->GroupID, TLogoBlobID::MaxChannel, "", success); + TabletId, Info->GroupID.GetRawId(), TLogoBlobID::MaxChannel, "", success); SendResponseAndDie(std::move(result)); } diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_discover_m3dc.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_discover_m3dc.cpp index ae285cc86ecb..aaf5b8224e7b 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_discover_m3dc.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_discover_m3dc.cpp @@ -662,7 +662,7 @@ class TBlobStorageGroupMirror3dcDiscoverRequest : public TBlobStorageGroupReques Y_ABORT_UNLESS(!Responded); const TDuration duration = TActivationContext::Now() - StartTime; LWPROBE(DSProxyRequestDuration, TEvBlobStorage::EvDiscover, 0, duration.SecondsFloat() * 1000.0, - TabletId, Info->GroupID, TLogoBlobID::MaxChannel, "", true); + TabletId, Info->GroupID.GetRawId(), TLogoBlobID::MaxChannel, "", true); SendResponseAndDie(std::move(response)); Responded = true; } @@ -675,7 +675,7 @@ class TBlobStorageGroupMirror3dcDiscoverRequest : public TBlobStorageGroupReques Y_ABORT_UNLESS(status != NKikimrProto::OK); const TDuration duration = TActivationContext::Now() - StartTime; LWPROBE(DSProxyRequestDuration, TEvBlobStorage::EvDiscover, 0, duration.SecondsFloat() * 1000.0, - TabletId, Info->GroupID, TLogoBlobID::MaxChannel, "", false); + TabletId, Info->GroupID.GetRawId(), TLogoBlobID::MaxChannel, "", false); std::unique_ptr response(new TEvBlobStorage::TEvDiscoverResult( status, MinGeneration, 0U)); response->ErrorReason = ErrorReason; diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_get.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_get.cpp index dd6134fe47b7..926e11c36b04 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_get.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_get.cpp @@ -184,7 +184,7 @@ class TBlobStorageGroupGetRequest : public TBlobStorageGroupRequestActorGetFailDomainOrderNumber(shortId), GetStartTime(record.GetTimestamps()), GetTotalTimeMs(record.GetTimestamps()), @@ -268,7 +268,7 @@ class TBlobStorageGroupGetRequest : public TBlobStorageGroupRequestActorGroupID, blob.Channel(), Info->GetFailDomainOrderNumber(shortId), + Info->GroupID.GetRawId(), blob.Channel(), Info->GetFailDomainOrderNumber(shortId), GetStartTime(record.GetTimestamps()), GetTotalTimeMs(record.GetTimestamps()), GetVDiskTimeMs(record.GetTimestamps()), @@ -363,7 +363,7 @@ class TBlobStorageGroupGetRequest : public TBlobStorageGroupRequestActorOrbit = std::move(Orbit); LWPROBE(DSProxyRequestDuration, TEvBlobStorage::EvGet, requestSize, duration.SecondsFloat() * 1000.0, tabletId, - evResult->GroupId, channel, NKikimrBlobStorage::EGetHandleClass_Name(GetImpl.GetHandleClass()), + evResult->GroupId.GetRawId(), channel, NKikimrBlobStorage::EGetHandleClass_Name(GetImpl.GetHandleClass()), success); A_LOG_LOG_S(true, success ? NLog::PRI_INFO : NLog::PRI_NOTICE, "BPG68", "Result# " << evResult->Print(false)); return SendResponseAndDie(std::unique_ptr(evResult.Release())); diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_impl.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_impl.cpp index 6c71e92a151b..0dbf35619f6b 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_impl.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_impl.cpp @@ -20,7 +20,7 @@ namespace NKikimr { TBlobStorageGroupProxy::TBlobStorageGroupProxy(ui32 groupId, bool isEjected, TIntrusivePtr &nodeMon, const TControlWrapper &enablePutBatching, const TControlWrapper &enableVPatch) - : GroupId(groupId) + : GroupId(TGroupId::FromValue(groupId)) , NodeMon(nodeMon) , IsEjected(isEjected) , ForceWaitAllDrives(false) diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_impl.h b/ydb/core/blobstorage/dsproxy/dsproxy_impl.h index 61e6f66e22c0..64057cab11aa 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_impl.h +++ b/ydb/core/blobstorage/dsproxy/dsproxy_impl.h @@ -53,8 +53,8 @@ class TBlobStorageGroupProxy : public TActorBootstrapped }; static std::atomic ThrottlingTimestamp; - - const ui32 GroupId; + using TGroupId = TIdWrapper; + const TGroupId GroupId; TIntrusivePtr Info; std::shared_ptr Topology; TIntrusivePtr NodeMon; @@ -114,7 +114,7 @@ class TBlobStorageGroupProxy : public TActorBootstrapped TLogPriorityMuteChecker ErrorStateMuteChecker; TLogPriorityMuteChecker InvalidGroupIdMuteChecker; - bool HasInvalidGroupId() const { return GroupId == Max(); } + bool HasInvalidGroupId() const { return GroupId.GetRawId() == Max(); } void ProcessInitQueue(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_mon.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_mon.cpp index 6b617a6b0fc4..c377b1bad142 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_mon.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_mon.cpp @@ -22,7 +22,7 @@ TBlobStorageGroupProxyMon::TBlobStorageGroupProxyMon(const TIntrusivePtr<::NMoni { if (info) { const TBlobStorageGroupInfo::TDynamicInfo& dyn = info->GetDynamicInfo(); - GroupIdGen = (ui64(dyn.GroupId) << 32) | dyn.GroupGeneration; + GroupIdGen = (ui64(dyn.GroupId.GetRawId()) << 32) | dyn.GroupGeneration; } BlockResponseTime.Initialize(ResponseGroup, "event", "block", "Response in millisec", Percentiles1); diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_patch.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_patch.cpp index 10aa5a53aa8e..d61353e616d6 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_patch.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_patch.cpp @@ -34,8 +34,9 @@ class TBlobStorageGroupPatchRequest : public TBlobStorageGroupRequestActor; + TGroupId OriginalGroupId; TLogoBlobID OriginalId; TLogoBlobID PatchedId; ui32 MaskForCookieBruteForcing; @@ -110,7 +111,7 @@ class TBlobStorageGroupPatchRequest : public TBlobStorageGroupRequestActorRestartCounter, std::move(span), std::move(ev->ExecutionRelay)) - , OriginalGroupId(ev->OriginalGroupId) + , OriginalGroupId(TGroupId::FromValue(ev->OriginalGroupId)) , OriginalId(ev->OriginalId) , PatchedId(ev->PatchedId) , MaskForCookieBruteForcing(ev->MaskForCookieBruteForcing) @@ -139,7 +140,7 @@ class TBlobStorageGroupPatchRequest : public TBlobStorageGroupRequestActor RestartQuery(ui32 counter) { ++*Mon->NodeMon->RestartPatch; TEvBlobStorage::TEvPatch *patch; - std::unique_ptr ev(patch = new TEvBlobStorage::TEvPatch(OriginalGroupId, OriginalId, PatchedId, + std::unique_ptr ev(patch = new TEvBlobStorage::TEvPatch(OriginalGroupId.GetRawId(), OriginalId, PatchedId, MaskForCookieBruteForcing, std::move(Diffs), DiffCount, Deadline)); patch->RestartCounter = counter; patch->Orbit = std::move(Orbit); @@ -549,7 +550,7 @@ class TBlobStorageGroupPatchRequest : public TBlobStorageGroupRequestActor> events; ui64 cookie = ((ui64)OriginalId.Hash() << 32) | PatchedId.Hash(); - events.emplace_back(new TEvBlobStorage::TEvVMovedPatch(OriginalGroupId, Info->GroupID, + events.emplace_back(new TEvBlobStorage::TEvVMovedPatch(OriginalGroupId.GetRawId(), Info->GroupID.GetRawId(), OriginalId, PatchedId, vDisk, false, cookie, Deadline)); events.back()->Orbit = std::move(Orbit); for (ui64 diffIdx = 0; diffIdx < DiffCount; ++diffIdx) { @@ -568,7 +569,7 @@ class TBlobStorageGroupPatchRequest : public TBlobStorageGroupRequestActorGroupID) { SendToProxy(std::move(get), PatchedId.Hash(), Span.GetTraceId()); } else { - SendToBSProxy(SelfId(), OriginalGroupId, get.release(), PatchedId.Hash(), Span.GetTraceId()); + SendToBSProxy(SelfId(), OriginalGroupId.GetRawId(), get.release(), PatchedId.Hash(), Span.GetTraceId()); } } @@ -788,7 +789,7 @@ class TBlobStorageGroupPatchRequest : public TBlobStorageGroupRequestActorType.ErasureFamily() == TErasureType::ErasureParityBlock) { result = TEvBlobStorage::TEvPatch::GetBlobIdWithSamePlacement(OriginalId, &truePatchedBlobId, - MaskForCookieBruteForcing, OriginalGroupId, Info->GroupID); + MaskForCookieBruteForcing, OriginalGroupId.GetRawId(), Info->GroupID.GetRawId()); if (result && PatchedId != truePatchedBlobId) { TStringBuilder str; str << "PatchedId wasn't from TEvBlobStorage::TEvPatch::GetBlobIdWithSamePlacement;"; diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_put.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_put.cpp index 6e7cdd31419a..2fd172f84b18 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_put.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_put.cpp @@ -245,7 +245,7 @@ class TBlobStorageGroupPutRequest : public TBlobStorageGroupRequestActorGroupID, blobId.Channel(), Info->GetFailDomainOrderNumber(shortId), + Info->GroupID.GetRawId(), blobId.Channel(), Info->GetFailDomainOrderNumber(shortId), GetStartTime(record.GetTimestamps()), GetTotalTimeMs(record.GetTimestamps()), GetVDiskTimeMs(record.GetTimestamps()), @@ -319,7 +319,7 @@ class TBlobStorageGroupPutRequest : public TBlobStorageGroupRequestActorGroupID, blobId.Channel(), Info->GetFailDomainOrderNumber(shortId), + Info->GroupID.GetRawId(), blobId.Channel(), Info->GetFailDomainOrderNumber(shortId), GetStartTime(record.GetTimestamps()), GetTotalTimeMs(record.GetTimestamps()), GetVDiskTimeMs(record.GetTimestamps()), @@ -419,7 +419,7 @@ class TBlobStorageGroupPutRequest : public TBlobStorageGroupRequestActorGroupID, blobId.Channel(), + blobId.TabletID(), Info->GroupID.GetRawId(), blobId.Channel(), NKikimrBlobStorage::EPutHandleClass_Name(HandleClass), success); ResponsesSent++; Y_ABORT_UNLESS(ResponsesSent <= PutImpl.Blobs.size()); diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_put_impl.h b/ydb/core/blobstorage/dsproxy/dsproxy_put_impl.h index b15b864837aa..e975498621c6 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_put_impl.h +++ b/ydb/core/blobstorage/dsproxy/dsproxy_put_impl.h @@ -119,7 +119,7 @@ class TPutImpl { std::move(ev->ExtraBlockChecks), true, std::move(ev->ExecutionRelay)); auto& blob = Blobs.back(); - LWPROBE(DSProxyBlobPutTactics, blob.BlobId.TabletID(), Info->GroupID, blob.BlobId.ToString(), Tactic, + LWPROBE(DSProxyBlobPutTactics, blob.BlobId.TabletID(), Info->GroupID.GetRawId(), blob.BlobId.ToString(), Tactic, NKikimrBlobStorage::EPutHandleClass_Name(GetPutHandleClass())); } @@ -150,7 +150,7 @@ class TPutImpl { Deadline = Max(Deadline, msg.Deadline); auto& blob = Blobs.back(); - LWPROBE(DSProxyBlobPutTactics, blob.BlobId.TabletID(), Info->GroupID, blob.BlobId.ToString(), Tactic, + LWPROBE(DSProxyBlobPutTactics, blob.BlobId.TabletID(), Info->GroupID.GetRawId(), blob.BlobId.ToString(), Tactic, NKikimrBlobStorage::EPutHandleClass_Name(GetPutHandleClass())); } diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_request.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_request.cpp index 2a7344105c7d..8217bcd40edb 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_request.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_request.cpp @@ -310,7 +310,7 @@ namespace NKikimr { } PutBatchedBucketQueue.clear(); ++*Mon->EventStopPutBatching; - LWPROBE(DSProxyBatchedPutRequest, BatchedPutRequestCount, GroupId); + LWPROBE(DSProxyBatchedPutRequest, BatchedPutRequestCount, GroupId.GetRawId()); BatchedPutRequestCount = 0; EnablePutBatching.Update(TActivationContext::Now()); } @@ -318,7 +318,7 @@ namespace NKikimr { void TBlobStorageGroupProxy::Handle(TEvStopBatchingGetRequests::TPtr& ev) { StopGetBatchingEvent = ev; ++*Mon->EventStopGetBatching; - LWPROBE(DSProxyBatchedGetRequest, BatchedGetRequestCount, GroupId); + LWPROBE(DSProxyBatchedGetRequest, BatchedGetRequestCount, GroupId.GetRawId()); BatchedGetRequestCount = 0; } diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_stat.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_stat.cpp index acf44aa47a72..4b6a3642f8c8 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_stat.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_stat.cpp @@ -39,7 +39,7 @@ namespace NKikimr { for (ui32 i = 0, num = Info->GetTotalVDisksNum(); i < num; ++i) { const TActorId vdiskServiceId = Info->GetActorId(i); const TActorId groupStatAggregatorId = MakeGroupStatAggregatorId(vdiskServiceId); - Send(groupStatAggregatorId, new TEvGroupStatReport(TActorId(), GroupId, Stat)); + Send(groupStatAggregatorId, new TEvGroupStatReport(TActorId(), GroupId.GetRawId(), Stat)); } } ScheduleUpdateGroupStat(); diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_state.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_state.cpp index 2862efe2fcb7..c0f6d77be57b 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_state.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_state.cpp @@ -301,7 +301,7 @@ namespace NKikimr { bool limited = IsLimitedKeyless || !fullIfPossible; IsFullMonitoring = IsLimitedKeyless || fullIfPossible; - TString name = Sprintf("%09" PRIu32, GroupId); + TString name = Sprintf("%09" PRIu32, GroupId.GetRawId()); TIntrusivePtr<::NMonitoring::TDynamicCounters> group = GetServiceCounters( AppData()->Counters, "dsproxy")->GetSubgroup("blobstorageproxy", name); TIntrusivePtr<::NMonitoring::TDynamicCounters> percentileGroup = GetServiceCounters( @@ -311,7 +311,7 @@ namespace NKikimr { Mon.Reset(new TBlobStorageGroupProxyMon(group, percentileGroup, overviewGroup, Info, NodeMon, limited)); BSProxyCtx.Reset(new TBSProxyContext(group->GetSubgroup("subsystem", "memproxy"))); - MonActor = RegisterWithSameMailbox(CreateBlobStorageGroupProxyMon(Mon, GroupId, Info, SelfId())); + MonActor = RegisterWithSameMailbox(CreateBlobStorageGroupProxyMon(Mon, GroupId.GetRawId(), Info, SelfId())); } } diff --git a/ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.cpp b/ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.cpp index 1a39d931f91f..3918ce78dbb1 100644 --- a/ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.cpp +++ b/ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.cpp @@ -10,7 +10,8 @@ namespace NKikimr { class TBlobStorageGroupProxyMockActor : public TActor - { + { + using TGroupId = TIdWrapper; TIntrusivePtr Model; void Handle(TEvBlobStorage::TEvPut::TPtr& ev) { @@ -106,7 +107,7 @@ namespace NKikimr { {} - TBlobStorageGroupProxyMockActor(ui32 groupId) + TBlobStorageGroupProxyMockActor(TGroupId groupId) : TActor(&TBlobStorageGroupProxyMockActor::StateFunc) , Model(MakeIntrusive(groupId)) {} @@ -117,7 +118,7 @@ namespace NKikimr { return new TBlobStorageGroupProxyMockActor(std::move(model)); } - IActor *CreateBlobStorageGroupProxyMockActor(ui32 groupId) { + IActor *CreateBlobStorageGroupProxyMockActor(TIdWrapper groupId) { return new TBlobStorageGroupProxyMockActor(groupId); } diff --git a/ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.h b/ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.h index 5cb37a571127..b06919dfb91d 100644 --- a/ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.h +++ b/ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.h @@ -1,7 +1,7 @@ #pragma once #include "defs.h" - +#include namespace NKikimr { namespace NFake { @@ -9,6 +9,6 @@ namespace NKikimr { } // NFake IActor *CreateBlobStorageGroupProxyMockActor(TIntrusivePtr model); - IActor *CreateBlobStorageGroupProxyMockActor(ui32 groupId); + IActor *CreateBlobStorageGroupProxyMockActor(TIdWrapper groupId); } // NKikimr diff --git a/ydb/core/blobstorage/dsproxy/mock/model.h b/ydb/core/blobstorage/dsproxy/mock/model.h index 59accba10d84..e20fa9b774e3 100644 --- a/ydb/core/blobstorage/dsproxy/mock/model.h +++ b/ydb/core/blobstorage/dsproxy/mock/model.h @@ -8,6 +8,7 @@ namespace NKikimr { namespace NFake { class TProxyDS : public TThrRefBase { + using TGroupId = TIdWrapper; using TTabletId = ui64; using TChannel = ui8; using TGeneration = ui32; @@ -56,10 +57,10 @@ namespace NFake { TMap Blobs; // By default only NKikimrBlobStorage::StatusIsValid is set TStorageStatusFlags StorageStatusFlags = TStorageStatusFlags(NKikimrBlobStorage::StatusIsValid); - const ui32 GroupId; + const TGroupId GroupId; public: - TProxyDS(ui32 groupId = 0) + TProxyDS(TGroupId groupId = TGroupId::Zero()) : GroupId(groupId) {} @@ -265,8 +266,7 @@ namespace NFake { Y_ABORT_UNLESS(from.TabletID() == to.TabletID()); Y_ABORT_UNLESS(from.Channel() == to.Channel()); - Y_ABORT_UNLESS(from.TabletID() == msg->TabletId); - + Y_ABORT_UNLESS(from.TabletID() == msg->TabletId); auto result = std::make_unique(NKikimrProto::OK, from, to, GroupId); auto process = [&](const TLogoBlobID& id, const TString& buffer) { diff --git a/ydb/core/blobstorage/dsproxy/ut/dsproxy_patch_ut.cpp b/ydb/core/blobstorage/dsproxy/ut/dsproxy_patch_ut.cpp index 6639d79f1349..08b19590fa2b 100644 --- a/ydb/core/blobstorage/dsproxy/ut/dsproxy_patch_ut.cpp +++ b/ydb/core/blobstorage/dsproxy/ut/dsproxy_patch_ut.cpp @@ -6,6 +6,7 @@ #include #include +#include #include @@ -297,8 +298,9 @@ void ConductGet(TTestBasicRuntime &runtime, const TTestArgs &args, ENaivePatchCa UNIT_ASSERT_VALUES_EQUAL(handle->Cookie, args.PatchedId.Hash()); std::unique_ptr getResult; + using TGroupId = TIdWrapper; if (resultStatus == NKikimrProto::OK) { - getResult = std::make_unique(NKikimrProto::OK, 1, args.CurrentGroupId); + getResult = std::make_unique(NKikimrProto::OK, 1, TGroupId::FromValue(args.CurrentGroupId)); if (naiveCase == ENaivePatchCase::ErrorOnGetItem) { getResult->Responses[0].Id = args.OriginalId; getResult->Responses[0].Status = NKikimrProto::ERROR; @@ -308,7 +310,7 @@ void ConductGet(TTestBasicRuntime &runtime, const TTestArgs &args, ENaivePatchCa getResult->Responses[0].Status = NKikimrProto::OK; } } else { - getResult = std::make_unique(NKikimrProto::ERROR, 0, args.CurrentGroupId); + getResult = std::make_unique(NKikimrProto::ERROR, 0, TGroupId::FromValue(args.CurrentGroupId)); } SendByHandle(runtime, handle, std::move(getResult)); @@ -339,7 +341,7 @@ void ConductPut(TTestBasicRuntime &runtime, const TTestArgs &args, ENaivePatchCa UNIT_ASSERT_VALUES_EQUAL(put->Buffer.ExtractUnderlyingContainerOrCopy(), patchedBuffer); std::unique_ptr putResult = std::make_unique( - resultStatus, args.PatchedId, args.StatusFlags, args.CurrentGroupId, args.ApproximateFreeSpaceShare); + resultStatus, args.PatchedId, args.StatusFlags, TIdWrapper::FromValue(args.CurrentGroupId), args.ApproximateFreeSpaceShare); SendByHandle(runtime, handle, std::move(putResult)); CTEST << "ConductPut: Finish\n"; } diff --git a/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_base.h b/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_base.h index db93080e0110..92c94f8dd148 100644 --- a/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_base.h +++ b/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_base.h @@ -68,7 +68,7 @@ class TFaultToleranceTestBase : public TActorCoroImpl { TAutoPtr PutWithResult(const TLogoBlobID& id, const TString& buffer, TEvBlobStorage::TEvPut::ETactic tactic = TEvBlobStorage::TEvPut::TacticDefault) { - SendToBSProxy(GetActorContext(), Info->GroupID, new TEvBlobStorage::TEvPut(id, buffer, TInstant::Max(), + SendToBSProxy(GetActorContext(), Info->GroupID.GetRawId(), new TEvBlobStorage::TEvPut(id, buffer, TInstant::Max(), NKikimrBlobStorage::TabletLog, tactic)); auto resp = WaitForSpecificEvent(&TFaultToleranceTestBase::ProcessUnexpectedEvent); CTEST << (TStringBuilder() << "PutResult: " << resp->Get()->ToString() << Endl); @@ -160,7 +160,7 @@ class TFaultToleranceTestBase : public TActorCoroImpl { auto query = std::make_unique(id, 0U /*shift*/, 0U /*size*/, TInstant::Max(), NKikimrBlobStorage::FastRead, mustRestoreFirst, !data); query->PhantomCheck = isRepl; - SendToBSProxy(GetActorContext(), Info->GroupID, query.release()); + SendToBSProxy(GetActorContext(), Info->GroupID.GetRawId(), query.release()); auto resp = WaitForSpecificEvent(&TFaultToleranceTestBase::ProcessUnexpectedEvent); TEvBlobStorage::TEvGetResult *msg = resp->Get(); UNIT_ASSERT_VALUES_EQUAL(msg->ResponseSz, 1); diff --git a/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_discover.h b/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_discover.h index 927408f8daee..795488f9068e 100644 --- a/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_discover.h +++ b/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_discover.h @@ -42,7 +42,7 @@ class TDiscoverFaultToleranceTest : public TFaultToleranceTestBaseGroupID, new TEvBlobStorage::TEvBlock(1, numGenerations - 1, TInstant::Max())); + SendToBSProxy(GetActorContext(), Info->GroupID.GetRawId(), new TEvBlobStorage::TEvBlock(1, numGenerations - 1, TInstant::Max())); auto response = WaitForSpecificEvent(&TDiscoverFaultToleranceTest::ProcessUnexpectedEvent); UNIT_ASSERT_VALUES_EQUAL(response->Get()->Status, NKikimrProto::OK); @@ -68,7 +68,7 @@ class TDiscoverFaultToleranceTest : public TFaultToleranceTestBaseGetQuorumChecker().CheckFailModelForSubgroup(failedSubgroupDisks); SetFailedDisks(failedDisks); - SendToBSProxy(GetActorContext(), Info->GroupID, new TEvBlobStorage::TEvDiscover(tabletId, 0, false, false, + SendToBSProxy(GetActorContext(), Info->GroupID.GetRawId(), new TEvBlobStorage::TEvDiscover(tabletId, 0, false, false, TInstant::Max(), 0, true)); auto resp = WaitForSpecificEvent(&TDiscoverFaultToleranceTest::ProcessUnexpectedEvent); @@ -109,7 +109,7 @@ class TDiscoverFaultToleranceTest : public TFaultToleranceTestBaseGroupID, new TEvBlobStorage::TEvDiscover(tabletId, 0, true, true, TInstant::Max(), 0, true)); + SendToBSProxy(GetActorContext(), Info->GroupID.GetRawId(), new TEvBlobStorage::TEvDiscover(tabletId, 0, true, true, TInstant::Max(), 0, true)); auto response = WaitForSpecificEvent(&TDiscoverFaultToleranceTest::ProcessUnexpectedEvent); UNIT_ASSERT_VALUES_EQUAL(response->Get()->Status, NKikimrProto::OK); diff --git a/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_get.h b/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_get.h index c601394d7755..fd02e8a502dc 100644 --- a/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_get.h +++ b/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_get.h @@ -55,7 +55,7 @@ class TGetWithRecoverFaultToleranceTest : public TFaultToleranceTestBaseGroupID, new TEvBlobStorage::TEvGet(items, ids.size(), TInstant::Max(), + SendToBSProxy(GetActorContext(), Info->GroupID.GetRawId(), new TEvBlobStorage::TEvGet(items, ids.size(), TInstant::Max(), NKikimrBlobStorage::FastRead, true, true, TEvBlobStorage::TEvGet::TForceBlockTabletData(1, index))); auto resp = WaitForSpecificEvent(&TGetWithRecoverFaultToleranceTest::ProcessUnexpectedEvent); TEvBlobStorage::TEvGetResult *msg = resp->Get(); diff --git a/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_range.h b/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_range.h index 7e20e851b4d2..e95d549b736b 100644 --- a/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_range.h +++ b/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_range.h @@ -117,7 +117,7 @@ class TRangeFaultToleranceTest : public TFaultToleranceTestBase(tabletId, TLogoBlobID(tabletId, generation, 0, 0, 0, 0), TLogoBlobID(tabletId, generation, Max(), 0, TLogoBlobID::MaxBlobSize, TLogoBlobID::MaxCookie), false, TInstant::Max()); - SendToBSProxy(GetActorContext(), Info->GroupID, query.release()); + SendToBSProxy(GetActorContext(), Info->GroupID.GetRawId(), query.release()); auto resp = WaitForSpecificEvent(&TRangeFaultToleranceTest::ProcessUnexpectedEvent); CTEST << resp->Get()->ToString() << Endl; UNIT_ASSERT_VALUES_EQUAL(resp->Get()->Status, expectedStatus); diff --git a/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_runtime.h b/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_runtime.h index d6220c72972a..2d884342f17a 100644 --- a/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_runtime.h +++ b/ydb/core/blobstorage/dsproxy/ut_ftol/dsproxy_fault_tolerance_ut_runtime.h @@ -89,7 +89,7 @@ class TFaultToleranceTestRuntime { TControlWrapper enableVPatch(DefaultEnableVPatch, false, true); IActor *dsproxy = CreateBlobStorageGroupProxyConfigured(TIntrusivePtr(GroupInfo), false, nodeMon, std::move(storagePoolCounters), enablePutBatching, enableVPatch); - setup->LocalServices.emplace_back(MakeBlobStorageProxyID(GroupInfo->GroupID), + setup->LocalServices.emplace_back(MakeBlobStorageProxyID(GroupInfo->GroupID.GetRawId()), TActorSetupCmd(dsproxy, TMailboxType::Simple, 0)); ActorSystem.reset(new TActorSystem(setup, AppData.get(), logSettings)); diff --git a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.cpp b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.cpp index b1759c4364a7..7fdea31984ca 100644 --- a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.cpp +++ b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.cpp @@ -553,7 +553,7 @@ TString TBlobStorageGroupInfo::TTopology::ToString() const { //////////////////////////////////////////////////////////////////////////// // TBlobStorageGroupInfo::TDynamicInfo //////////////////////////////////////////////////////////////////////////// -TBlobStorageGroupInfo::TDynamicInfo::TDynamicInfo(ui32 groupId, ui32 groupGen) +TBlobStorageGroupInfo::TDynamicInfo::TDynamicInfo(TGroupId groupId, ui32 groupGen) : GroupId(groupId) , GroupGeneration(groupGen) {} @@ -563,7 +563,7 @@ TBlobStorageGroupInfo::TDynamicInfo::TDynamicInfo(ui32 groupId, ui32 groupGen) //////////////////////////////////////////////////////////////////////////// TBlobStorageGroupInfo::TBlobStorageGroupInfo(TBlobStorageGroupType gtype, ui32 numVDisksPerFailDomain, ui32 numFailDomains, ui32 numFailRealms, const TVector *vdiskIds, EEncryptionMode encryptionMode, - ELifeCyclePhase lifeCyclePhase, TCypherKey key, ui32 groupId) + ELifeCyclePhase lifeCyclePhase, TCypherKey key, TGroupId groupId) : GroupID(groupId) , GroupGeneration(1) , Type(gtype) @@ -638,7 +638,7 @@ TIntrusivePtr TBlobStorageGroupInfo::Parse(const NKikimrB auto erasure = (TBlobStorageGroupType::EErasureSpecies)group.GetErasureSpecies(); TBlobStorageGroupType type(erasure); TBlobStorageGroupInfo::TTopology topology(type); - TBlobStorageGroupInfo::TDynamicInfo dyn(group.GetGroupID(), group.GetGroupGeneration()); + TBlobStorageGroupInfo::TDynamicInfo dyn(TGroupId::FromValue(group.GetGroupID()), group.GetGroupGeneration()); topology.FailRealms.resize(group.RingsSize()); for (ui32 ringIdx = 0; ringIdx < group.RingsSize(); ++ringIdx) { const auto& realm = group.GetRings(ringIdx); @@ -917,11 +917,12 @@ TString TBlobStorageGroupInfo::ToString() const { TVDiskID VDiskIDFromVDiskID(const NKikimrBlobStorage::TVDiskID &x) { - return TVDiskID(x.GetGroupID(), x.GetGroupGeneration(), x.GetRing(), x.GetDomain(), x.GetVDisk()); + using TGroupId = TIdWrapper; + return TVDiskID(TGroupId::FromValue(x.GetGroupID()), x.GetGroupGeneration(), x.GetRing(), x.GetDomain(), x.GetVDisk()); } void VDiskIDFromVDiskID(const TVDiskID &id, NKikimrBlobStorage::TVDiskID *proto) { - proto->SetGroupID(id.GroupID); + proto->SetGroupID(id.GroupID.GetRawId()); proto->SetGroupGeneration(id.GroupGeneration); proto->SetRing(id.FailRealm); proto->SetDomain(id.FailDomain); @@ -956,8 +957,8 @@ TVDiskID VDiskIDFromString(TString str, bool* isGenerationSet) { } groupGeneration = IntFromString(parts[1]); } - - return TVDiskID(IntFromString(parts[0]), + using TGroupId = TIdWrapper; + return TVDiskID(TGroupId::FromValue(IntFromString(parts[0])), groupGeneration, IntFromString(parts[2]), IntFromString(parts[3]), diff --git a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.h b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.h index d6e293dfabe4..fbda4b952348 100644 --- a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.h +++ b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.h @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -83,7 +84,7 @@ class TBlobStorageGroupInfo : public TThrRefBase { using TVDiskIds = TStackVec; using TServiceIds = TStackVec; using TOrderNums = TStackVec; - + using TGroupId = TIdWrapper; enum EBlobStateFlags { EBSF_DISINTEGRATED = 1, // Group is disintegrated. EBSF_UNRECOVERABLE = 1 << 1, // Recoverability: Blob can not be recovered. Ever. @@ -280,13 +281,13 @@ class TBlobStorageGroupInfo : public TThrRefBase { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// struct TDynamicInfo { // blobstorage group id - const ui32 GroupId; + const TGroupId GroupId; // blobstorage group generation const ui32 GroupGeneration; // map to quickly get Service id (TActorId) from its order number inside TTopology TVector ServiceIdForOrderNumber; - TDynamicInfo(ui32 groupId, ui32 groupGen); + TDynamicInfo(TGroupId groupId, ui32 groupGen); TDynamicInfo(const TDynamicInfo&) = default; TDynamicInfo(TDynamicInfo&&) = default; TDynamicInfo &operator =(TDynamicInfo&&) = default; @@ -311,7 +312,7 @@ class TBlobStorageGroupInfo : public TThrRefBase { explicit TBlobStorageGroupInfo(TBlobStorageGroupType gtype, ui32 numVDisksPerFailDomain = 1, ui32 numFailDomains = 0, ui32 numFailRealms = 1, const TVector *vdiskIds = nullptr, EEncryptionMode encryptionMode = EEM_ENC_V1, ELifeCyclePhase lifeCyclePhase = ELCP_IN_USE, - TCypherKey key = TCypherKey((const ui8*)"TestKey", 8), ui32 groupId = 0); + TCypherKey key = TCypherKey((const ui8*)"TestKey", 8), TGroupId groupId = TGroupId::Zero()); TBlobStorageGroupInfo(std::shared_ptr topology, TDynamicInfo&& rti, TString storagePoolName, TMaybe acceptedScope, NPDisk::EDeviceType deviceType); @@ -415,7 +416,7 @@ class TBlobStorageGroupInfo : public TThrRefBase { public: // blobstorage group id - const ui32 GroupID; + const TGroupId GroupID; // blobstorage group generation const ui32 GroupGeneration; // erasure primarily @@ -519,4 +520,4 @@ inline void Out(IOutputStream& o << "KEY_NOT_LOADED"; break; } -} +} \ No newline at end of file diff --git a/ydb/core/blobstorage/incrhuge/incrhuge_keeper.cpp b/ydb/core/blobstorage/incrhuge/incrhuge_keeper.cpp index 6ad6e6d7fb90..46d2a2f3f25d 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge_keeper.cpp +++ b/ydb/core/blobstorage/incrhuge/incrhuge_keeper.cpp @@ -3,6 +3,7 @@ #include "incrhuge_keeper_recovery_scan.h" #include #include +#include #include #include #include @@ -26,8 +27,9 @@ namespace NKikimr { } void TKeeper::Bootstrap(const TActorContext& ctx) { + using TGroupId = TIdWrapper; // send yard init message - TVDiskID myVDiskId(~0, ~0, 'H', 'I', 'K'); + TVDiskID myVDiskId(TGroupId::FromValue(~0), ~0, 'H', 'I', 'K'); ctx.Send(State.Settings.PDiskActorId, new NPDisk::TEvYardInit(State.Settings.InitOwnerRound, myVDiskId, State.Settings.PDiskGuid, ctx.SelfID)); Become(&TKeeper::StateFunc); diff --git a/ydb/core/blobstorage/incrhuge/ut/test_actor_seq.h b/ydb/core/blobstorage/incrhuge/ut/test_actor_seq.h index 10e577d4973d..23ef09f97df9 100644 --- a/ydb/core/blobstorage/incrhuge/ut/test_actor_seq.h +++ b/ydb/core/blobstorage/incrhuge/ut/test_actor_seq.h @@ -48,7 +48,7 @@ class TTestActorSeq : public TActorBootstrapped { {} void Bootstrap(const TActorContext& ctx) { - TVDiskID vdiskId(~0, ~0, 'H', 'I', 'K'); + TVDiskID vdiskId(TIdWrapper::FromValue(~0), ~0, 'H', 'I', 'K'); ctx.Send(KeeperId, new TEvIncrHugeInit(vdiskId, Owner, 0)); Become(&TTestActorSeq::StateFunc); } diff --git a/ydb/core/blobstorage/nodewarden/defs.h b/ydb/core/blobstorage/nodewarden/defs.h index 14d5d32154f8..29d2d5737c94 100644 --- a/ydb/core/blobstorage/nodewarden/defs.h +++ b/ydb/core/blobstorage/nodewarden/defs.h @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/ydb/core/blobstorage/nodewarden/distconf.h b/ydb/core/blobstorage/nodewarden/distconf.h index 51c03b9205d7..683c40adee3f 100644 --- a/ydb/core/blobstorage/nodewarden/distconf.h +++ b/ydb/core/blobstorage/nodewarden/distconf.h @@ -578,7 +578,7 @@ namespace NKikimr::NStorage { continue; } const auto vdiskId = VDiskIDFromVDiskID(vdisk.GetVDiskID()); - const auto it = groups.find(vdiskId.GroupID); + const auto it = groups.find(vdiskId.GroupID.GetRawId()); if (it == groups.end()) { return makeError(TStringBuilder() << "VDisk " << vdiskId << " does not match any static group"); } @@ -604,7 +604,7 @@ namespace NKikimr::NStorage { const auto [begin, end] = confirm.equal_range(key); for (auto it = begin; it != end; ++it) { const TVDiskID& vdiskId = it->second; - TGroupRecord& group = groups.at(vdiskId.GroupID); + TGroupRecord& group = groups.at(vdiskId.GroupID.GetRawId()); group.Confirmed |= {&group.Info->GetTopology(), vdiskId}; } }); diff --git a/ydb/core/blobstorage/nodewarden/distconf_generate.cpp b/ydb/core/blobstorage/nodewarden/distconf_generate.cpp index 010c35b3aa69..b160fdca129a 100644 --- a/ydb/core/blobstorage/nodewarden/distconf_generate.cpp +++ b/ydb/core/blobstorage/nodewarden/distconf_generate.cpp @@ -212,7 +212,7 @@ namespace NKikimr::NStorage { for (const auto& vdisk : ss.GetVDisks()) { const TVDiskID vdiskId = VDiskIDFromVDiskID(vdisk.GetVDiskID()); - if (vdiskId.GroupID == groupId) { + if (vdiskId.GroupID.GetRawId() == groupId) { vdiskLocations.emplace(vdiskId, vdisk.GetVDiskLocation()); } } @@ -428,7 +428,7 @@ namespace NKikimr::NStorage { for (size_t i = 0; i < sSet->VDisksSize(); ++i) { const auto& vdisk = sSet->GetVDisks(i); const TVDiskID vdiskId = VDiskIDFromVDiskID(vdisk.GetVDiskID()); - if (vdiskId.GroupID != groupId || vdisk.GetEntityStatus() == NKikimrBlobStorage::EEntityStatus::DESTROY) { + if (vdiskId.GroupID.GetRawId() != groupId || vdisk.GetEntityStatus() == NKikimrBlobStorage::EEntityStatus::DESTROY) { continue; } auto *m = sSet->MutableVDisks(i); @@ -483,7 +483,7 @@ namespace NKikimr::NStorage { sLoc->SetPDiskGuid(pdisk.GetPDiskGuid()); auto *sDisk = sSet->AddVDisks(); - VDiskIDFromVDiskID(TVDiskID(groupId, groupGeneration, vdiskId), sDisk->MutableVDiskID()); + VDiskIDFromVDiskID(TVDiskID(TIdWrapper::FromValue(groupId), groupGeneration, vdiskId), sDisk->MutableVDiskID()); sDisk->SetVDiskKind(NKikimrBlobStorage::TVDiskKind::Default); sDisk->MutableVDiskLocation()->CopyFrom(*sLoc); if (const auto it = donors.find(vdiskId); it != donors.end()) { diff --git a/ydb/core/blobstorage/nodewarden/distconf_invoke.cpp b/ydb/core/blobstorage/nodewarden/distconf_invoke.cpp index 524fe84e320f..083338b375bd 100644 --- a/ydb/core/blobstorage/nodewarden/distconf_invoke.cpp +++ b/ydb/core/blobstorage/nodewarden/distconf_invoke.cpp @@ -181,7 +181,7 @@ namespace NKikimr::NStorage { bool found = false; const TVDiskID vdiskId = VDiskIDFromVDiskID(cmd.GetVDiskId()); for (const auto& group : Self->StorageConfig->GetBlobStorageConfig().GetServiceSet().GetGroups()) { - if (group.GetGroupID() == vdiskId.GroupID) { + if (group.GetGroupID() == vdiskId.GroupID.GetRawId()) { if (group.GetGroupGeneration() != vdiskId.GroupGeneration) { return FinishWithError(TResult::ERROR, TStringBuilder() << "group generation mismatch" << " GroupId# " << group.GetGroupID() @@ -313,11 +313,11 @@ namespace NKikimr::NStorage { // scan failed disks according to BS_CONTROLLER's data TBlobStorageGroupInfo::TGroupVDisks failedVDisks(&GroupInfo->GetTopology()); for (const auto& vslot : BaseConfig->GetVSlot()) { - if (vslot.GetGroupId() != vdiskId.GroupID || vslot.GetGroupGeneration() != vdiskId.GroupGeneration) { + if (vslot.GetGroupId() != vdiskId.GroupID.GetRawId() || vslot.GetGroupGeneration() != vdiskId.GroupGeneration) { continue; } if (!vslot.GetReady()) { - const TVDiskID vdiskId(vslot.GetGroupId(), vslot.GetGroupGeneration(), vslot.GetFailRealmIdx(), + const TVDiskID vdiskId(TIdWrapper::FromValue(vslot.GetGroupId()), vslot.GetGroupGeneration(), vslot.GetFailRealmIdx(), vslot.GetFailDomainIdx(), vslot.GetVDiskIdx()); failedVDisks |= {&GroupInfo->GetTopology(), vdiskId}; } @@ -374,9 +374,9 @@ namespace NKikimr::NStorage { } for (const auto& group : ss.GetGroups()) { - if (group.GetGroupID() == vdiskId.GroupID) { + if (group.GetGroupID() == vdiskId.GroupID.GetRawId()) { try { - Self->AllocateStaticGroup(&config, vdiskId.GroupID, vdiskId.GroupGeneration + 1, + Self->AllocateStaticGroup(&config, vdiskId.GroupID.GetRawId(), vdiskId.GroupGeneration + 1, TBlobStorageGroupType((TBlobStorageGroupType::EErasureSpecies)group.GetErasureSpecies()), settings.GetGeometry(), settings.GetPDiskFilter(), replacedDisks, forbid, maxSlotSize, &BaseConfig.value(), cmd.GetConvertToDonor(), cmd.GetIgnoreVSlotQuotaCheck(), @@ -430,7 +430,7 @@ namespace NKikimr::NStorage { ui32 actualGroupGeneration = 0; for (const auto& group : ss->GetGroups()) { - if (group.GetGroupID() == vdiskId.GroupID) { + if (group.GetGroupID() == vdiskId.GroupID.GetRawId()) { actualGroupGeneration = group.GetGroupGeneration(); break; } diff --git a/ydb/core/blobstorage/nodewarden/distconf_validate.cpp b/ydb/core/blobstorage/nodewarden/distconf_validate.cpp index 1b95421456ea..adde62299f84 100644 --- a/ydb/core/blobstorage/nodewarden/distconf_validate.cpp +++ b/ydb/core/blobstorage/nodewarden/distconf_validate.cpp @@ -39,7 +39,7 @@ namespace NKikimr::NStorage { THashMap> vdisks; for (const auto& vslot : current.GetVDisks()) { TVDiskID vdiskId = VDiskIDFromVDiskID(vslot.GetVDiskID()); - const auto it = currentGroupGens.find(vdiskId.GroupID); + const auto it = currentGroupGens.find(vdiskId.GroupID.GetRawId()); if (it == currentGroupGens.end() || it->second != vdiskId.GroupGeneration) { continue; } @@ -60,7 +60,7 @@ namespace NKikimr::NStorage { THashSet changedGroups; for (const auto& vslot : proposed.GetVDisks()) { TVDiskID vdiskId = VDiskIDFromVDiskID(vslot.GetVDiskID()); - const auto groupIt = proposedGroupGens.find(vdiskId.GroupID); + const auto groupIt = proposedGroupGens.find(vdiskId.GroupID.GetRawId()); if (groupIt == proposedGroupGens.end() || groupIt->second != vdiskId.GroupGeneration) { continue; } @@ -75,7 +75,7 @@ namespace NKikimr::NStorage { const bool changed = it->second != std::make_tuple(l.GetNodeID(), l.GetPDiskID(), l.GetVDiskSlotID(), l.GetPDiskGuid()) || invalidatedNodeIds.contains(l.GetNodeID()) || invalidatedPDiskIds.contains(std::make_tuple(l.GetNodeID(), l.GetPDiskID())); - if (changed && !changedGroups.emplace(vdiskId.GroupID).second) { + if (changed && !changedGroups.emplace(vdiskId.GroupID.GetRawId()).second) { return "more than one slot has changed in group"; } @@ -318,7 +318,7 @@ namespace NKikimr::NStorage { const ui32 vslotId = l.GetVDiskSlotID(); const ui64 pdiskGuid = l.GetPDiskGuid(); - const TVDiskID vdiskId(groupId, groupGen, failRealmIdx, failDomainIdx, vdiskIdx); + const TVDiskID vdiskId(TIdWrapper::FromValue(groupId), groupGen, failRealmIdx, failDomainIdx, vdiskIdx); if (const auto it = vdisks.find(vdiskId); it == vdisks.end()) { return TStringBuilder() << "vslot with specific VDiskID is not found" diff --git a/ydb/core/blobstorage/nodewarden/node_warden_group.cpp b/ydb/core/blobstorage/nodewarden/node_warden_group.cpp index 0e9a8e208cd2..89d59490e455 100644 --- a/ydb/core/blobstorage/nodewarden/node_warden_group.cpp +++ b/ydb/core/blobstorage/nodewarden/node_warden_group.cpp @@ -272,11 +272,11 @@ namespace NKikimr::NStorage { void TNodeWarden::Handle(TEvBlobStorage::TEvUpdateGroupInfo::TPtr ev) { auto *msg = ev->Get(); bool fromResolver = false; - if (const auto it = Groups.find(msg->GroupId); it != Groups.end() && ev->Sender == it->second.GroupResolver) { + if (const auto it = Groups.find(msg->GroupId.GetRawId()); it != Groups.end() && ev->Sender == it->second.GroupResolver) { it->second.GroupResolver = {}; fromResolver = true; } - ApplyGroupInfo(msg->GroupId, msg->GroupGeneration, msg->GroupInfo ? &*msg->GroupInfo : nullptr, false, fromResolver); + ApplyGroupInfo(msg->GroupId.GetRawId(), msg->GroupGeneration, msg->GroupInfo ? &*msg->GroupInfo : nullptr, false, fromResolver); } void TNodeWarden::HandleGetGroup(TAutoPtr ev) { diff --git a/ydb/core/blobstorage/nodewarden/node_warden_group_resolver.cpp b/ydb/core/blobstorage/nodewarden/node_warden_group_resolver.cpp index a9b78c702432..deb374818ec9 100644 --- a/ydb/core/blobstorage/nodewarden/node_warden_group_resolver.cpp +++ b/ydb/core/blobstorage/nodewarden/node_warden_group_resolver.cpp @@ -258,7 +258,7 @@ namespace NKikimr::NStorage { if (auto *result = GetResultingGroupInfo()) { STLOG(PRI_INFO, BS_NODE, NW86, "TGroupResolverActor::ProcessResultAndFinish", (GroupId, GroupId), (Result, *result)); - Send(MakeBlobStorageNodeWardenID(SelfId().NodeId()), new TEvBlobStorage::TEvUpdateGroupInfo(GroupId, + Send(MakeBlobStorageNodeWardenID(SelfId().NodeId()), new TEvBlobStorage::TEvUpdateGroupInfo(TIdWrapper::FromValue(GroupId), result->GetGroupGeneration(), *result)); PassAway(); } else { // restart from the beginning @@ -338,7 +338,7 @@ namespace NKikimr::NStorage { } for (const auto& [key, value] : LocalVDisks) { if (const auto& r = value.RuntimeData; r && !r->DonorMode) { - record.AddStartedGroupIds(r->GroupInfo->GroupID); + record.AddStartedGroupIds(r->GroupInfo->GroupID.GetRawId()); } } Send(ev->Sender, res.release(), 0, ev->Cookie); diff --git a/ydb/core/blobstorage/nodewarden/node_warden_impl.cpp b/ydb/core/blobstorage/nodewarden/node_warden_impl.cpp index 682bf9cd9421..c7dc138e1c7b 100644 --- a/ydb/core/blobstorage/nodewarden/node_warden_impl.cpp +++ b/ydb/core/blobstorage/nodewarden/node_warden_impl.cpp @@ -625,12 +625,12 @@ void TNodeWarden::Handle(TEvStatusUpdate::TPtr ev) { const auto& r = vdisk.RuntimeData; const auto& info = r->GroupInfo; - if (const ui32 groupId = info->GroupID; TGroupID(groupId).ConfigurationType() == EGroupConfigurationType::Static) { + if (const ui32 groupId = info->GroupID.GetRawId(); TGroupID(groupId).ConfigurationType() == EGroupConfigurationType::Static) { for (const auto& item : StorageConfig.GetBlobStorageConfig().GetServiceSet().GetVDisks()) { const TVDiskID vdiskId = VDiskIDFromVDiskID(item.GetVDiskID()); - if (vdiskId.GroupID == groupId && info->GetTopology().GetOrderNumber(vdiskId) == r->OrderNumber && + if (vdiskId.GroupID.GetRawId() == groupId && info->GetTopology().GetOrderNumber(vdiskId) == r->OrderNumber && item.HasDonorMode() && item.GetEntityStatus() != NKikimrBlobStorage::EEntityStatus::DESTROY) { - SendDropDonorQuery(vslotId.NodeId, vslotId.PDiskId, vslotId.VDiskSlotId, TVDiskID(groupId, 0, + SendDropDonorQuery(vslotId.NodeId, vslotId.PDiskId, vslotId.VDiskSlotId, TVDiskID(TIdWrapper::FromValue(groupId), 0, info->GetVDiskId(r->OrderNumber))); break; } diff --git a/ydb/core/blobstorage/nodewarden/node_warden_impl.h b/ydb/core/blobstorage/nodewarden/node_warden_impl.h index 985680808f02..31714a1868b5 100644 --- a/ydb/core/blobstorage/nodewarden/node_warden_impl.h +++ b/ydb/core/blobstorage/nodewarden/node_warden_impl.h @@ -5,6 +5,7 @@ #include "node_warden_events.h" #include +#include #include #include diff --git a/ydb/core/blobstorage/nodewarden/node_warden_proxy.cpp b/ydb/core/blobstorage/nodewarden/node_warden_proxy.cpp index b770dd5a4ce8..c5d3041396d1 100644 --- a/ydb/core/blobstorage/nodewarden/node_warden_proxy.cpp +++ b/ydb/core/blobstorage/nodewarden/node_warden_proxy.cpp @@ -22,7 +22,7 @@ void TNodeWarden::StartLocalProxy(ui32 groupId) { if (EnableProxyMock) { // create mock proxy - proxy.reset(CreateBlobStorageGroupProxyMockActor(groupId)); + proxy.reset(CreateBlobStorageGroupProxyMockActor(TIdWrapper::FromValue(groupId))); } else if (auto info = NeedGroupInfo(groupId)) { if (info->BlobDepotId) { TActorId proxyActorId; diff --git a/ydb/core/blobstorage/nodewarden/node_warden_vdisk.cpp b/ydb/core/blobstorage/nodewarden/node_warden_vdisk.cpp index 7a1fa34dbecb..1ab22f235bf5 100644 --- a/ydb/core/blobstorage/nodewarden/node_warden_vdisk.cpp +++ b/ydb/core/blobstorage/nodewarden/node_warden_vdisk.cpp @@ -215,7 +215,7 @@ namespace NKikimr::NStorage { // for dynamic groups -- start state aggregator if (TGroupID(groupInfo->GroupID).ConfigurationType() == EGroupConfigurationType::Dynamic) { - StartAggregator(vdiskServiceId, groupInfo->GroupID); + StartAggregator(vdiskServiceId, groupInfo->GroupID.GetRawId()); } Y_ABORT_UNLESS(vdisk.ScrubState == TVDiskRecord::EScrubState::IDLE); diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.cpp index e3a28a71126f..e5034c52a91a 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.cpp +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.cpp @@ -1326,7 +1326,7 @@ void TTestWhiteboard::TestFSM(const TActorContext &ctx) { TActorId nodeWardenId = MakeBlobStorageNodeWardenID(SelfId().NodeId()); ctx.ExecutorThread.ActorSystem->RegisterLocalService(nodeWardenId, SelfId()); for (int owner = 0; owner < ExpectedOwnerCount; ++owner) { - ctx.Send(Yard, new NPDisk::TEvYardInit(2, TVDiskID(0, 0, 0, 0, owner), *PDiskGuid, TActorId(), SelfId())); + ctx.Send(Yard, new NPDisk::TEvYardInit(2, TVDiskID(TIdWrapper::Zero(), 0, 0, 0, owner), *PDiskGuid, TActorId(), SelfId())); } TestStep += 10; break; diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.h index 23112cae5138..3ac766c84070 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.h @@ -7,6 +7,7 @@ #include "blobstorage_pdisk_chunk_id_formatter.h" #include +#include namespace NKikimr { @@ -1655,7 +1656,7 @@ class TTestSysLogReordering : public TBaseTest { switch (TestStep) { case 0: VERBOSE_COUT(" Sending TEvInit"); - VDiskID.GroupID = MyNum; + VDiskID.GroupID = TIdWrapper::FromValue(MyNum); ctx.Send(Yard, new NPDisk::TEvYardInit(2, VDiskID, *PDiskGuid)); break; case 10: @@ -1797,7 +1798,7 @@ class TTestSysLogReorderingLogCheck : public TBaseTest { switch (TestStep) { case 0: VERBOSE_COUT(" Sending TEvInit"); - VDiskID.GroupID = MyNum; + VDiskID.GroupID = TIdWrapper::FromValue(MyNum); ctx.Send(Yard, new NPDisk::TEvYardInit(2, VDiskID, *PDiskGuid)); break; case 10: diff --git a/ydb/core/blobstorage/pdisk/mock/pdisk_mock.cpp b/ydb/core/blobstorage/pdisk/mock/pdisk_mock.cpp index 4b5275627ec0..058f3ce12caa 100644 --- a/ydb/core/blobstorage/pdisk/mock/pdisk_mock.cpp +++ b/ydb/core/blobstorage/pdisk/mock/pdisk_mock.cpp @@ -271,14 +271,14 @@ struct TPDiskMockState::TImpl { void SetReadOnly(const TVDiskID& vDiskId, bool isReadOnly) { if (isReadOnly) { - ReadOnlyVDisks.insert(vDiskId.GroupID); + ReadOnlyVDisks.insert(vDiskId.GroupID.GetRawId()); } else { - ReadOnlyVDisks.erase(vDiskId.GroupID); + ReadOnlyVDisks.erase(vDiskId.GroupID.GetRawId()); } } bool IsReadOnly(const TVDiskID& vDiskId) const { - return ReadOnlyVDisks.contains(vDiskId.GroupID); + return ReadOnlyVDisks.contains(vDiskId.GroupID.GetRawId()); } }; diff --git a/ydb/core/blobstorage/testing/group_overseer/group_overseer.cpp b/ydb/core/blobstorage/testing/group_overseer/group_overseer.cpp index aa0debaccb0c..6bdc5e57d1a4 100644 --- a/ydb/core/blobstorage/testing/group_overseer/group_overseer.cpp +++ b/ydb/core/blobstorage/testing/group_overseer/group_overseer.cpp @@ -97,7 +97,7 @@ namespace NKikimr::NTesting { T::EventType != TEvBlobStorage::EvInplacePatchResult && T::EventType != TEvBlobStorage::EvCollectGarbageResult && T::EventType != TEvBlobStorage::EvDiscoverResult) { - Y_ABORT_UNLESS(groupId == msg.GroupId); + Y_ABORT_UNLESS(groupId == msg.GroupId.GetRawId()); } const auto groupStateIt = GroupStates.try_emplace(groupId, groupId).first; diff --git a/ydb/core/blobstorage/ut_blobstorage/assimilation.cpp b/ydb/core/blobstorage/ut_blobstorage/assimilation.cpp index 18f3dce1bf58..316cff18c934 100644 --- a/ydb/core/blobstorage/ut_blobstorage/assimilation.cpp +++ b/ydb/core/blobstorage/ut_blobstorage/assimilation.cpp @@ -31,7 +31,7 @@ Y_UNIT_TEST_SUITE(VDiskAssimilation) { for (size_t i = 0; i < numBlocks; ++i) { const ui64 tabletId = 1 + i; const ui32 generation = 1; - SendToBSProxy(edge, info->GroupID, new TEvBlobStorage::TEvBlock(tabletId, generation, TInstant::Max())); + SendToBSProxy(edge, info->GroupID.GetRawId(), new TEvBlobStorage::TEvBlock(tabletId, generation, TInstant::Max())); blocks.emplace(tabletId, generation); } @@ -39,7 +39,7 @@ Y_UNIT_TEST_SUITE(VDiskAssimilation) { const ui64 tabletId = 1 + RandomNumber(10u); TString data = TStringBuilder() << i; TLogoBlobID id(tabletId, 2, 2, 0, data.size(), i); - SendToBSProxy(edge, info->GroupID, new TEvBlobStorage::TEvPut(id, data, TInstant::Max())); + SendToBSProxy(edge, info->GroupID.GetRawId(), new TEvBlobStorage::TEvPut(id, data, TInstant::Max())); blobs.emplace(id); } @@ -51,7 +51,7 @@ Y_UNIT_TEST_SUITE(VDiskAssimilation) { const ui32 collectGen = 1 + i; const ui32 collectStep = 1 + i; const bool hard = RandomNumber(2u); - SendToBSProxy(edge, info->GroupID, new TEvBlobStorage::TEvCollectGarbage(tabletId, recordGen, + SendToBSProxy(edge, info->GroupID.GetRawId(), new TEvBlobStorage::TEvCollectGarbage(tabletId, recordGen, recordGenCounter, channel, true, collectGen, collectStep, nullptr, nullptr, TInstant::Max(), false, hard)); diff --git a/ydb/core/blobstorage/ut_blobstorage/balancing.cpp b/ydb/core/blobstorage/ut_blobstorage/balancing.cpp index 2937892b59fd..f981b4ca32e3 100644 --- a/ydb/core/blobstorage/ut_blobstorage/balancing.cpp +++ b/ydb/core/blobstorage/ut_blobstorage/balancing.cpp @@ -66,7 +66,7 @@ struct TTestEnv { const TActorId sender = Env.Runtime->AllocateEdgeActor(GroupInfo->GetActorId(*RunningNodes.begin()).NodeId(), __FILE__, __LINE__); auto ev = std::make_unique(id, data, TInstant::Max()); Env.Runtime->WrapInActorContext(sender, [&] { - SendToBSProxy(sender, GroupInfo->GroupID, ev.release()); + SendToBSProxy(sender, GroupInfo->GroupID.GetRawId(), ev.release()); }); auto res = Env.WaitForEdgeActorEvent(sender, false); Cerr << "TEvPutResult: " << res->Get()->ToString() << Endl; @@ -90,7 +90,7 @@ struct TTestEnv { mustRestoreFirst ); Env.Runtime->WrapInActorContext(sender, [&] () { - SendToBSProxy(sender, GroupInfo->GroupID, ev.release()); + SendToBSProxy(sender, GroupInfo->GroupID.GetRawId(), ev.release()); }); TInstant getDeadline = Env.Now() + TDuration::Seconds(30); auto res = Env.WaitForEdgeActorEvent(sender, /* termOnCapture */ false, getDeadline); diff --git a/ydb/core/blobstorage/ut_blobstorage/counting_events.cpp b/ydb/core/blobstorage/ut_blobstorage/counting_events.cpp index e9de1c0fab97..64c8907ec1ba 100644 --- a/ydb/core/blobstorage/ut_blobstorage/counting_events.cpp +++ b/ydb/core/blobstorage/ut_blobstorage/counting_events.cpp @@ -17,7 +17,7 @@ Y_UNIT_TEST_SUITE(CountingEvents) { std::unique_ptr ev = std::make_unique(blobId, data, TInstant::Max()); test.Runtime->WrapInActorContext(test.Edge, [&] { - SendToBSProxy(test.Edge, test.Info->GroupID, ev.release()); + SendToBSProxy(test.Edge, test.Info->GroupID.GetRawId(), ev.release()); }); std::unique_ptr handle = test.Runtime->WaitForEdgeActorEvent({test.Edge}); @@ -31,7 +31,7 @@ Y_UNIT_TEST_SUITE(CountingEvents) { { std::unique_ptr ev = std::make_unique(blobId, 0, 0, TInstant::Max(), NKikimrBlobStorage::AsyncRead); test.Runtime->WrapInActorContext(test.Edge, [&] { - SendToBSProxy(test.Edge, test.Info->GroupID, ev.release()); + SendToBSProxy(test.Edge, test.Info->GroupID.GetRawId(), ev.release()); }); std::unique_ptr handle = test.Runtime->WaitForEdgeActorEvent({test.Edge}); UNIT_ASSERT_EQUAL(handle->Type, TEvBlobStorage::EvGetResult); @@ -48,7 +48,7 @@ Y_UNIT_TEST_SUITE(CountingEvents) { std::unique_ptr ev = std::make_unique(blobId.TabletID(), blobId.Generation(), blobId.Step(), blobId.Channel(), true, blobId.Generation(), blobId.Step(), nullptr, nullptr, TInstant::Max(), false); test.Runtime->WrapInActorContext(test.Edge, [&] { - SendToBSProxy(test.Edge, test.Info->GroupID, ev.release()); + SendToBSProxy(test.Edge, test.Info->GroupID.GetRawId(), ev.release()); }); std::unique_ptr handle = test.Runtime->WaitForEdgeActorEvent({test.Edge}); UNIT_ASSERT_EQUAL(handle->Type, TEvBlobStorage::EvCollectGarbageResult); @@ -58,7 +58,7 @@ Y_UNIT_TEST_SUITE(CountingEvents) { TIntrusivePtr ReceiveGroupQueues(const TTestInfo &test) { test.Runtime->WrapInActorContext(test.Edge, [&] { - SendToBSProxy(test.Edge, test.Info->GroupID, new TEvRequestProxySessionsState); + SendToBSProxy(test.Edge, test.Info->GroupID.GetRawId(), new TEvRequestProxySessionsState); }); std::unique_ptr handle = test.Runtime->WaitForEdgeActorEvent({test.Edge}); UNIT_ASSERT_EQUAL_C(handle->Type, TEvBlobStorage::EvProxySessionsState, "expected# " << (ui64)TEvBlobStorage::EvProxySessionsState diff --git a/ydb/core/blobstorage/ut_blobstorage/defrag.cpp b/ydb/core/blobstorage/ut_blobstorage/defrag.cpp index 3dd92b5089dc..9313dd39f71a 100644 --- a/ydb/core/blobstorage/ut_blobstorage/defrag.cpp +++ b/ydb/core/blobstorage/ut_blobstorage/defrag.cpp @@ -52,7 +52,7 @@ static TIntrusivePtr PrepareEnv(TEnvironmentSetup& env, T { const TActorId& sender = env.Runtime->AllocateEdgeActor(1); env.Runtime->WrapInActorContext(sender, [&] { - SendToBSProxy(sender, info->GroupID, new TEvBlobStorage::TEvCollectGarbage(1, 1, 1, 0, true, 1, Max(), + SendToBSProxy(sender, info->GroupID.GetRawId(), new TEvBlobStorage::TEvCollectGarbage(1, 1, 1, 0, true, 1, Max(), new TVector(*keep), nullptr, TInstant::Max(), true)); }); const auto& res = env.WaitForEdgeActorEvent(sender); @@ -170,7 +170,7 @@ Y_UNIT_TEST_SUITE(Defragmentation) { { const TActorId& sender = env.Runtime->AllocateEdgeActor(1); env.Runtime->WrapInActorContext(sender, [&] { - SendToBSProxy(sender, info->GroupID, new TEvBlobStorage::TEvCollectGarbage(1, 1, 2, 0, false, 0, 0, + SendToBSProxy(sender, info->GroupID.GetRawId(), new TEvBlobStorage::TEvCollectGarbage(1, 1, 2, 0, false, 0, 0, nullptr, new TVector(keep), TInstant::Max(), true)); }); const auto& res = env.WaitForEdgeActorEvent(sender); @@ -196,7 +196,7 @@ Y_UNIT_TEST_SUITE(Defragmentation) { { const TActorId& sender = env.Runtime->AllocateEdgeActor(1); env.Runtime->WrapInActorContext(sender, [&] { - SendToBSProxy(sender, info->GroupID, new TEvBlobStorage::TEvCollectGarbage(1, 1, 3, 0, false, 0, 0, + SendToBSProxy(sender, info->GroupID.GetRawId(), new TEvBlobStorage::TEvCollectGarbage(1, 1, 3, 0, false, 0, 0, new TVector(keep), nullptr, TInstant::Max(), true)); }); const auto& res = env.WaitForEdgeActorEvent(sender); diff --git a/ydb/core/blobstorage/ut_blobstorage/discover.cpp b/ydb/core/blobstorage/ut_blobstorage/discover.cpp index ab65e20e0555..c72008ce641e 100644 --- a/ydb/core/blobstorage/ut_blobstorage/discover.cpp +++ b/ydb/core/blobstorage/ut_blobstorage/discover.cpp @@ -14,7 +14,7 @@ Y_UNIT_TEST_SUITE(Discover) { ev->ReaderTabletData = {*readerTabletId, *readerTabletGeneration}; } test.Runtime->WrapInActorContext(test.Edge, [&] { - SendToBSProxy(test.Edge, test.Info->GroupID, ev.release()); + SendToBSProxy(test.Edge, test.Info->GroupID.GetRawId(), ev.release()); }); std::unique_ptr handle = test.Runtime->WaitForEdgeActorEvent({test.Edge}); UNIT_ASSERT_EQUAL(handle->Type, TEvBlobStorage::EvGetResult); @@ -33,7 +33,7 @@ Y_UNIT_TEST_SUITE(Discover) { std::unique_ptr ev = std::make_unique(blobId, data, TInstant::Max()); test.Runtime->WrapInActorContext(test.Edge, [&] { - SendToBSProxy(test.Edge, test.Info->GroupID, ev.release()); + SendToBSProxy(test.Edge, test.Info->GroupID.GetRawId(), ev.release()); }); std::unique_ptr handle = test.Runtime->WaitForEdgeActorEvent({test.Edge}); @@ -71,7 +71,7 @@ Y_UNIT_TEST_SUITE(Discover) { ); test.Runtime->WrapInActorContext(test.Edge, [&] { - SendToBSProxy(test.Edge, test.Info->GroupID, ev.release()); + SendToBSProxy(test.Edge, test.Info->GroupID.GetRawId(), ev.release()); }); auto handle = test.Runtime->WaitForEdgeActorEvent({test.Edge}); diff --git a/ydb/core/blobstorage/ut_blobstorage/extra_block_checks.cpp b/ydb/core/blobstorage/ut_blobstorage/extra_block_checks.cpp index 7aa8ad42b096..3a74892a3779 100644 --- a/ydb/core/blobstorage/ut_blobstorage/extra_block_checks.cpp +++ b/ydb/core/blobstorage/ut_blobstorage/extra_block_checks.cpp @@ -16,8 +16,8 @@ Y_UNIT_TEST_SUITE(ExtraBlockChecks) { const auto& edge = runtime->AllocateEdgeActor(1, __FILE__, __LINE__); runtime->WrapInActorContext(edge, [&] { - SendToBSProxy(edge, info->GroupID, new TEvBlobStorage::TEvBlock(1, 10, TInstant::Max())); - SendToBSProxy(edge, info->GroupID, new TEvBlobStorage::TEvBlock(2, 10, TInstant::Max())); + SendToBSProxy(edge, info->GroupID.GetRawId(), new TEvBlobStorage::TEvBlock(1, 10, TInstant::Max())); + SendToBSProxy(edge, info->GroupID.GetRawId(), new TEvBlobStorage::TEvBlock(2, 10, TInstant::Max())); }); { auto res = env.WaitForEdgeActorEvent(edge, false); @@ -31,7 +31,7 @@ Y_UNIT_TEST_SUITE(ExtraBlockChecks) { runtime->WrapInActorContext(edge, [&] { auto ev = std::make_unique(TLogoBlobID(1, 11, 1, 0, data.size(), 1), data, TInstant::Max()); ev->ExtraBlockChecks.emplace_back(2, 10); - SendToBSProxy(edge, info->GroupID, ev.release()); + SendToBSProxy(edge, info->GroupID.GetRawId(), ev.release()); }); { auto res = env.WaitForEdgeActorEvent(edge, false); @@ -39,7 +39,7 @@ Y_UNIT_TEST_SUITE(ExtraBlockChecks) { } runtime->WrapInActorContext(edge, [&] { - SendToBSProxy(edge, info->GroupID, new TEvBlobStorage::TEvPut(TLogoBlobID(1, 11, 1, 0, data.size(), 2), data, TInstant::Max())); + SendToBSProxy(edge, info->GroupID.GetRawId(), new TEvBlobStorage::TEvPut(TLogoBlobID(1, 11, 1, 0, data.size(), 2), data, TInstant::Max())); }); { auto res = env.WaitForEdgeActorEvent(edge, false); @@ -51,8 +51,8 @@ Y_UNIT_TEST_SUITE(ExtraBlockChecks) { runtime->WrapInActorContext(edge, [&] { auto ev = std::make_unique(a, data, TInstant::Max()); ev->ExtraBlockChecks.emplace_back(2, 10); - SendToBSProxy(edge, info->GroupID, ev.release()); - SendToBSProxy(edge, info->GroupID, new TEvBlobStorage::TEvPut(b, data, TInstant::Max())); + SendToBSProxy(edge, info->GroupID.GetRawId(), ev.release()); + SendToBSProxy(edge, info->GroupID.GetRawId(), new TEvBlobStorage::TEvPut(b, data, TInstant::Max())); }); { std::unordered_map map; diff --git a/ydb/core/blobstorage/ut_blobstorage/get.cpp b/ydb/core/blobstorage/ut_blobstorage/get.cpp index c0ebf5da0a79..73c719d54acd 100644 --- a/ydb/core/blobstorage/ut_blobstorage/get.cpp +++ b/ydb/core/blobstorage/ut_blobstorage/get.cpp @@ -20,7 +20,7 @@ Y_UNIT_TEST_SUITE(Get) { NKikimrBlobStorage::AsyncRead, mustRestoreFirst, isIndexOnly, forceBlockTabletData); ev->ReaderTabletData = readerTabletData; test.Runtime->WrapInActorContext(test.Edge, [&] { - SendToBSProxy(test.Edge, test.Info->GroupID, ev.release()); + SendToBSProxy(test.Edge, test.Info->GroupID.GetRawId(), ev.release()); }); std::unique_ptr handle = test.Runtime->WaitForEdgeActorEvent({test.Edge}); UNIT_ASSERT_EQUAL(handle->Type, TEvBlobStorage::EvGetResult); @@ -39,7 +39,7 @@ Y_UNIT_TEST_SUITE(Get) { std::unique_ptr ev = std::make_unique(blobId, data, TInstant::Max()); test.Runtime->WrapInActorContext(test.Edge, [&] { - SendToBSProxy(test.Edge, test.Info->GroupID, ev.release()); + SendToBSProxy(test.Edge, test.Info->GroupID.GetRawId(), ev.release()); }); std::unique_ptr handle = test.Runtime->WaitForEdgeActorEvent({test.Edge}); @@ -69,7 +69,7 @@ Y_UNIT_TEST_SUITE(Get) { auto ev = std::make_unique(tabletId, blockedTabletGeneration, TInstant::Max()); test.Runtime->WrapInActorContext(test.Edge, [&] { - SendToBSProxy(test.Edge, test.Info->GroupID, ev.release()); + SendToBSProxy(test.Edge, test.Info->GroupID.GetRawId(), ev.release()); }); auto handle = test.Runtime->WaitForEdgeActorEvent({test.Edge}); diff --git a/ydb/core/blobstorage/ut_blobstorage/group_reconfiguration.cpp b/ydb/core/blobstorage/ut_blobstorage/group_reconfiguration.cpp index f51997b6f59e..bdf139760668 100644 --- a/ydb/core/blobstorage/ut_blobstorage/group_reconfiguration.cpp +++ b/ydb/core/blobstorage/ut_blobstorage/group_reconfiguration.cpp @@ -1,4 +1,5 @@ #include +#include #include "ut_helpers.h" Y_UNIT_TEST_SUITE(GroupReconfiguration) { @@ -69,7 +70,7 @@ Y_UNIT_TEST_SUITE(GroupReconfiguration) { // Start load actors for (ui32 nodeId = 1; nodeId < numNodes - 1; ++nodeId) { if (loadNodesWVDisks || (nodesInGroup.count(nodeId) > 0 && nodeId != toNodeId && nodeId != fromNodeId)) { - TInflightActor* newActor = new TInflightActorPut({100, 1, TDuration::MilliSeconds(100), groupId}, 1_KB); + TInflightActor* newActor = new TInflightActorPut({100, 1, TDuration::MilliSeconds(100), TIdWrapper::FromValue(groupId)}, 1_KB); actors.push_back(newActor); env->Runtime->Register(newActor, nodeId); } @@ -459,14 +460,16 @@ Y_UNIT_TEST_SUITE(GroupReconfiguration) { "Put", "HugePut", "Get", "HugeGet", "Patch", "HugePatch", }; + using TGroupId = TIdWrapper; + for (ui32 nodeId = 1; nodeId < numNodes; ++nodeId) { std::vector newActors = { - new TInflightActorPut({requests, 1, TDuration::MilliSeconds(1), groupId}, blobSize), - new TInflightActorPut({requestsHuge, 1, TDuration::MilliSeconds(1), groupId}, hugeBlobSize), - new TInflightActorGet({requests, 1, TDuration::MilliSeconds(1), groupId}, blobSize), - new TInflightActorGet({requestsHuge, 1, TDuration::MilliSeconds(1), groupId}, hugeBlobSize), - new TInflightActorPatch({requests, 1, TDuration::MilliSeconds(1), groupId}, blobSize), - new TInflightActorPatch({requestsHuge, 1, TDuration::MilliSeconds(1), groupId}, hugeBlobSize), + new TInflightActorPut({requests, 1, TDuration::MilliSeconds(1), TGroupId::FromValue(groupId)}, blobSize), + new TInflightActorPut({requestsHuge, 1, TDuration::MilliSeconds(1), TGroupId::FromValue(groupId)}, hugeBlobSize), + new TInflightActorGet({requests, 1, TDuration::MilliSeconds(1), TGroupId::FromValue(groupId)}, blobSize), + new TInflightActorGet({requestsHuge, 1, TDuration::MilliSeconds(1), TGroupId::FromValue(groupId)}, hugeBlobSize), + new TInflightActorPatch({requests, 1, TDuration::MilliSeconds(1), TGroupId::FromValue(groupId)}, blobSize), + new TInflightActorPatch({requestsHuge, 1, TDuration::MilliSeconds(1), TGroupId::FromValue(groupId)}, hugeBlobSize), }; // remember to add new actor type to actorTypes Y_ABORT_UNLESS(newActors.size() == actorTypes.size()); diff --git a/ydb/core/blobstorage/ut_blobstorage/index_restore_get.cpp b/ydb/core/blobstorage/ut_blobstorage/index_restore_get.cpp index 1841dc669eaa..4677670229e6 100644 --- a/ydb/core/blobstorage/ut_blobstorage/index_restore_get.cpp +++ b/ydb/core/blobstorage/ut_blobstorage/index_restore_get.cpp @@ -37,7 +37,7 @@ Y_UNIT_TEST_SUITE(IndexRestoreGet) { { const auto edge = env.Runtime->AllocateEdgeActor(1, __FILE__, __LINE__); env.Runtime->WrapInActorContext(edge, [&] { - SendToBSProxy(edge, info->GroupID, new TEvBlobStorage::TEvCollectGarbage(id.TabletID(), id.Generation(), + SendToBSProxy(edge, info->GroupID.GetRawId(), new TEvBlobStorage::TEvCollectGarbage(id.TabletID(), id.Generation(), 1, id.Channel(), true, id.Generation(), id.Step(), new TVector{id}, nullptr, TInstant::Max(), true, false)); }); @@ -74,7 +74,7 @@ Y_UNIT_TEST_SUITE(IndexRestoreGet) { env.Runtime->WrapInActorContext(edge, [&] { // SendToBSProxy(edge, info->GroupID, new TEvBlobStorage::TEvGet(id, 0, 0, TInstant::Max(), // NKikimrBlobStorage::EGetHandleClass::FastRead, true, true)); - SendToBSProxy(edge, info->GroupID, new TEvBlobStorage::TEvRange(id.TabletID(), id, id, true, TInstant::Max(), true)); + SendToBSProxy(edge, info->GroupID.GetRawId(), new TEvBlobStorage::TEvRange(id.TabletID(), id, id, true, TInstant::Max(), true)); }); auto res = env.WaitForEdgeActorEvent(edge); UNIT_ASSERT_VALUES_EQUAL(res->Get()->Status, NKikimrProto::OK); diff --git a/ydb/core/blobstorage/ut_blobstorage/lib/env.h b/ydb/core/blobstorage/ut_blobstorage/lib/env.h index 98bf955f42bd..30299baded51 100644 --- a/ydb/core/blobstorage/ut_blobstorage/lib/env.h +++ b/ydb/core/blobstorage/ut_blobstorage/lib/env.h @@ -5,6 +5,7 @@ #include "node_warden_mock.h" #include +#include #include @@ -543,7 +544,7 @@ struct TEnvironmentSetup { for (const auto& vslot : baseConfig.GetVSlot()) { const auto& l = vslot.GetVSlotId(); vslotToDiskMap.emplace(MakeBlobStorageVDiskID(l.GetNodeId(), l.GetPDiskId(), l.GetVSlotId()), - TVDiskID(vslot.GetGroupId(), vslot.GetGroupGeneration(), vslot.GetFailRealmIdx(), + TVDiskID(TIdWrapper::FromValue(vslot.GetGroupId()), vslot.GetGroupGeneration(), vslot.GetFailRealmIdx(), vslot.GetFailDomainIdx(), vslot.GetVDiskIdx())); } for (const auto& group : baseConfig.GetGroup()) { @@ -556,7 +557,7 @@ struct TEnvironmentSetup { const auto it = vslotToDiskMap.find(MakeBlobStorageVDiskID(l.GetNodeId(), l.GetPDiskId(), l.GetVSlotId())); Y_ABORT_UNLESS(it != vslotToDiskMap.end()); const TVDiskID& vdiskId = it->second; - Y_ABORT_UNLESS(vdiskId.GroupID == groupId); + Y_ABORT_UNLESS(vdiskId.GroupID.GetRawId() == groupId); Y_ABORT_UNLESS(vdiskId.GroupGeneration == group.GetGroupGeneration()); const bool inserted = vdisks.emplace(it->second, it->first).second; Y_ABORT_UNLESS(inserted); @@ -568,7 +569,7 @@ struct TEnvironmentSetup { TBlobStorageGroupInfo::TTopology topology(TBlobStorageGroupType( TBlobStorageGroupType::ErasureSpeciesByName(group.GetErasureSpecies())), numFailRealms, numFailDomainsPerFailRealm, numVDisksPerFailDomain); - TBlobStorageGroupInfo::TDynamicInfo dyn(group.GetGroupId(), group.GetGroupGeneration()); + TBlobStorageGroupInfo::TDynamicInfo dyn(TIdWrapper::FromValue(group.GetGroupId()), group.GetGroupGeneration()); for (const auto& [vdiskId, vdiskActorId] : vdisks) { dyn.PushBackActorId(vdiskActorId); } @@ -581,7 +582,7 @@ struct TEnvironmentSetup { TActorId CreateQueueActor(const TVDiskID& vdiskId, NKikimrBlobStorage::EVDiskQueueId queueId, ui32 index) { TBSProxyContextPtr bspctx = MakeIntrusive(MakeIntrusive<::NMonitoring::TDynamicCounters>()); auto flowRecord = MakeIntrusive(); - auto groupInfo = GetGroupInfo(vdiskId.GroupID); + auto groupInfo = GetGroupInfo(vdiskId.GroupID.GetRawId()); std::unique_ptr actor(CreateVDiskBackpressureClient(groupInfo, vdiskId, queueId, MakeIntrusive<::NMonitoring::TDynamicCounters>(), bspctx, NBackpressure::TQueueClientId(NBackpressure::EQueueClientType::DSProxy, index), TStringBuilder() diff --git a/ydb/core/blobstorage/ut_blobstorage/lib/node_warden_mock_bsc.cpp b/ydb/core/blobstorage/ut_blobstorage/lib/node_warden_mock_bsc.cpp index d642dd2435f7..cf2b1e1386cd 100644 --- a/ydb/core/blobstorage/ut_blobstorage/lib/node_warden_mock_bsc.cpp +++ b/ydb/core/blobstorage/ut_blobstorage/lib/node_warden_mock_bsc.cpp @@ -7,7 +7,7 @@ void TNodeWardenMockActor::SendRegisterNode() { TVector startedDynamicGroups, groupGenerations; for (const auto& [groupId, group] : Groups) { - startedDynamicGroups.push_back(group->Info->GroupID); + startedDynamicGroups.push_back(group->Info->GroupID.GetRawId()); groupGenerations.push_back(group->Info->GroupGeneration); } @@ -148,7 +148,7 @@ void TNodeWardenMockActor::Handle(TEvBlobStorage::TEvControllerNodeServiceSetUpd UNIT_ASSERT(!vdiskp->DonorMode); // do not allow donor mode reverts } - TGroupState *group = GetGroup(vdiskId.GroupID); + TGroupState *group = GetGroup(vdiskId.GroupID.GetRawId()); UNIT_ASSERT(group); TPDiskState *pdisk = GetPDisk(vslotId); @@ -184,7 +184,7 @@ void TNodeWardenMockActor::Handle(TEvBlobStorage::TEvControllerNodeServiceSetUpd vdiskp->AllocatedSize = 0; vdiskp->Status = NKikimrBlobStorage::EVDiskStatus::INIT_PENDING; } else if (!vdiskp) { - const auto groupIt = Setup->Groups.find(vdiskId.GroupID); + const auto groupIt = Setup->Groups.find(vdiskId.GroupID.GetRawId()); UNIT_ASSERT(groupIt != Setup->Groups.end()); const TSetup::TGroupInfo& groupInfo = groupIt->second; diff --git a/ydb/core/blobstorage/ut_blobstorage/monitoring.cpp b/ydb/core/blobstorage/ut_blobstorage/monitoring.cpp index 21b08edb82e1..11352fd52753 100644 --- a/ydb/core/blobstorage/ut_blobstorage/monitoring.cpp +++ b/ydb/core/blobstorage/ut_blobstorage/monitoring.cpp @@ -78,7 +78,7 @@ void TestDSProxyAndVDiskEqualCost(const TBlobStorageGroupInfo::TTopology& topolo updateCounters(); UNIT_ASSERT_VALUES_EQUAL(dsproxyCost, vdiskCost); - actor->SetGroupId(groupId); + actor->SetGroupId(TIdWrapper::FromValue(groupId)); env->Runtime->Register(actor, 1); env->Sim(TDuration::Minutes(5)); @@ -225,7 +225,7 @@ void TestBurst(ui32 requests, ui32 inflight, TDuration delay, ELoadDistribution SetupEnv(topology, env, groupSize, groupType, groupId, pdiskLayout, burstThresholdNs, diskTimeAvailableScale); - actor->SetGroupId(groupId); + actor->SetGroupId(TIdWrapper::FromValue(groupId)); env->Runtime->Register(actor, 1); env->Sim(TDuration::Minutes(10)); diff --git a/ydb/core/blobstorage/ut_blobstorage/patch.cpp b/ydb/core/blobstorage/ut_blobstorage/patch.cpp index c0246738eec9..6a40cc07bd41 100644 --- a/ydb/core/blobstorage/ut_blobstorage/patch.cpp +++ b/ydb/core/blobstorage/ut_blobstorage/patch.cpp @@ -12,7 +12,7 @@ Y_UNIT_TEST_SUITE(BlobPatching) { std::unique_ptr ev = std::make_unique(blobId, data, TInstant::Max()); test.Runtime->WrapInActorContext(test.Edge, [&] { - SendToBSProxy(test.Edge, test.Info->GroupID, ev.release()); + SendToBSProxy(test.Edge, test.Info->GroupID.GetRawId(), ev.release()); }); std::unique_ptr handle = test.Runtime->WaitForEdgeActorEvent({test.Edge}); @@ -29,7 +29,7 @@ Y_UNIT_TEST_SUITE(BlobPatching) { std::unique_ptr ev = std::make_unique(getQueries, 1, TInstant::Max(), NKikimrBlobStorage::AsyncRead); test.Runtime->WrapInActorContext(test.Edge, [&] { - SendToBSProxy(test.Edge, test.Info->GroupID, ev.release()); + SendToBSProxy(test.Edge, test.Info->GroupID.GetRawId(), ev.release()); }); std::unique_ptr handle = test.Runtime->WaitForEdgeActorEvent({test.Edge}); UNIT_ASSERT_EQUAL(handle->Type, TEvBlobStorage::EvGetResult); @@ -47,10 +47,10 @@ Y_UNIT_TEST_SUITE(BlobPatching) { for (ui32 idx = 0; idx < diffs.size(); ++idx) { diffArr[idx] = diffs[idx]; } - std::unique_ptr ev = std::make_unique(test.Info->GroupID, originalBlobId, patchedBlobId, + std::unique_ptr ev = std::make_unique(test.Info->GroupID.GetRawId(), originalBlobId, patchedBlobId, mask, std::move(diffArr), diffs.size(), TInstant::Max()); test.Runtime->WrapInActorContext(test.Edge, [&] { - SendToBSProxy(test.Edge, test.Info->GroupID, ev.release()); + SendToBSProxy(test.Edge, test.Info->GroupID.GetRawId(), ev.release()); }); std::unique_ptr handle = test.Runtime->WaitForEdgeActorEvent({test.Edge}); UNIT_ASSERT_EQUAL(handle->Type, TEvBlobStorage::EvPatchResult); @@ -84,7 +84,7 @@ Y_UNIT_TEST_SUITE(BlobPatching) { TString patchedData1 = ApplyDiffs(data, diffs1); TLogoBlobID patchedBlobId1(1, 1, 1, 0, size, 0); TEvBlobStorage::TEvPatch::GetBlobIdWithSamePlacement(originalBlobId, &patchedBlobId1, 0, - test.Info->GroupID, test.Info->GroupID); + test.Info->GroupID.GetRawId(), test.Info->GroupID.GetRawId()); SendPatch(test, originalBlobId, patchedBlobId1, 0, diffs1, NKikimrProto::OK); SendGet(test, patchedBlobId1, patchedData1, NKikimrProto::OK); @@ -94,14 +94,14 @@ Y_UNIT_TEST_SUITE(BlobPatching) { TString patchedData2 = ApplyDiffs(data, diffs2); TLogoBlobID patchedBlobId2(1, 1, 2, 0, size, 0); TEvBlobStorage::TEvPatch::GetBlobIdWithSamePlacement(originalBlobId, &patchedBlobId2, 0, - test.Info->GroupID, test.Info->GroupID); + test.Info->GroupID.GetRawId(), test.Info->GroupID.GetRawId()); SendPatch(test, originalBlobId, patchedBlobId2, 0, diffs2, NKikimrProto::OK); SendGet(test, patchedBlobId2, patchedData2, NKikimrProto::OK); TLogoBlobID patchedBlobId3(1, 1, 3, 0, size, 0); TLogoBlobID truePatchedBlobId3(1, 1, 3, 0, size, 0); TEvBlobStorage::TEvPatch::GetBlobIdWithSamePlacement(originalBlobId, &truePatchedBlobId3, TLogoBlobID::MaxCookie, - test.Info->GroupID, test.Info->GroupID); + test.Info->GroupID.GetRawId(), test.Info->GroupID.GetRawId()); UNIT_ASSERT(patchedBlobId3 != truePatchedBlobId3); NKikimrProto::EReplyStatus statusWhenNotMatchingCookie = (erasure == "block-4-2" ? NKikimrProto::ERROR : NKikimrProto::OK); SendPatch(test, originalBlobId, patchedBlobId3, TLogoBlobID::MaxCookie, diffs2, statusWhenNotMatchingCookie); @@ -131,7 +131,7 @@ Y_UNIT_TEST_SUITE(BlobPatching) { for (ui32 patchIdx = 0; patchIdx < patchCount; ++patchIdx) { TLogoBlobID patchedBlobId(1, 1, patchIdx + 1, 0, size, 0); TEvBlobStorage::TEvPatch::GetBlobIdWithSamePlacement(originalBlobId, &patchedBlobId, TLogoBlobID::MaxCookie, - test.Info->GroupID, test.Info->GroupID); + test.Info->GroupID.GetRawId(), test.Info->GroupID.GetRawId()); SendPatch(test, originalBlobId, patchedBlobId, 0, diffs, NKikimrProto::OK); SendGet(test, patchedBlobId, patchedData, NKikimrProto::OK); } diff --git a/ydb/core/blobstorage/ut_blobstorage/read_only_vdisk.cpp b/ydb/core/blobstorage/ut_blobstorage/read_only_vdisk.cpp index b75971f11072..1ed663c66d6a 100644 --- a/ydb/core/blobstorage/ut_blobstorage/read_only_vdisk.cpp +++ b/ydb/core/blobstorage/ut_blobstorage/read_only_vdisk.cpp @@ -44,7 +44,7 @@ struct TTetsEnv { const TActorId sender = Env.Runtime->AllocateEdgeActor(VDiskActorId.NodeId(), __FILE__, __LINE__); auto ev = std::make_unique(id, data, TInstant::Max()); Env.Runtime->WrapInActorContext(sender, [&] { - SendToBSProxy(sender, GroupInfo->GroupID, ev.release()); + SendToBSProxy(sender, GroupInfo->GroupID.GetRawId(), ev.release()); }); auto res = Env.WaitForEdgeActorEvent(sender, false); UNIT_ASSERT_VALUES_EQUAL(res->Get()->Status, expectedStatus); @@ -64,7 +64,7 @@ struct TTetsEnv { mustRestoreFirst ); Env.Runtime->WrapInActorContext(sender, [&] () { - SendToBSProxy(sender, GroupInfo->GroupID, ev.release()); + SendToBSProxy(sender, GroupInfo->GroupID.GetRawId(), ev.release()); }); TInstant getDeadline = Env.Now() + TDuration::Seconds(30); auto res = Env.WaitForEdgeActorEvent(sender, /* termOnCapture */ false, getDeadline); @@ -125,7 +125,7 @@ struct TTetsEnv { nullptr, nullptr, TInstant::Max() ); Env.Runtime->WrapInActorContext(sender, [&] { - SendToBSProxy(sender, GroupInfo->GroupID, ev.release()); + SendToBSProxy(sender, GroupInfo->GroupID.GetRawId(), ev.release()); }); auto res = Env.WaitForEdgeActorEvent(sender, false); Env.Sim(TDuration::Seconds(10)); @@ -138,7 +138,7 @@ struct TTetsEnv { 1, 1, false, true, TInstant::Max(), 0, false ); Env.Runtime->WrapInActorContext(sender, [&] { - SendToBSProxy(sender, GroupInfo->GroupID, ev.release()); + SendToBSProxy(sender, GroupInfo->GroupID.GetRawId(), ev.release()); }); auto res = Env.WaitForEdgeActorEvent(sender, false); return res; diff --git a/ydb/core/blobstorage/ut_blobstorage/scrub.cpp b/ydb/core/blobstorage/ut_blobstorage/scrub.cpp index 4f7843adcb65..73230ccc1f9e 100644 --- a/ydb/core/blobstorage/ut_blobstorage/scrub.cpp +++ b/ydb/core/blobstorage/ut_blobstorage/scrub.cpp @@ -26,7 +26,7 @@ Y_UNIT_TEST_SUITE(BlobScrubbing) { TLogoBlobID id(1, 1, i, 0, data.size(), 0); auto ev = std::make_unique(id, data, TInstant::Max()); env.Runtime->WrapInActorContext(sender, [&] { - SendToBSProxy(sender, vdiskId.GroupID, ev.release()); + SendToBSProxy(sender, vdiskId.GroupID.GetRawId(), ev.release()); }); auto res = env.WaitForEdgeActorEvent(sender, false); UNIT_ASSERT_VALUES_EQUAL(res->Get()->Status, NKikimrProto::OK); diff --git a/ydb/core/blobstorage/ut_blobstorage/scrub_fast.cpp b/ydb/core/blobstorage/ut_blobstorage/scrub_fast.cpp index 2e24b5318d41..7fba4f1b8531 100644 --- a/ydb/core/blobstorage/ut_blobstorage/scrub_fast.cpp +++ b/ydb/core/blobstorage/ut_blobstorage/scrub_fast.cpp @@ -23,7 +23,7 @@ void Test() { { // write data to group TActorId sender = runtime->AllocateEdgeActor(1); runtime->WrapInActorContext(sender, [&] { - SendToBSProxy(sender, info->GroupID, new TEvBlobStorage::TEvPut(id, data, TInstant::Max())); + SendToBSProxy(sender, info->GroupID.GetRawId(), new TEvBlobStorage::TEvPut(id, data, TInstant::Max())); }); auto res = env.WaitForEdgeActorEvent(sender); UNIT_ASSERT_VALUES_EQUAL(res->Get()->Status, NKikimrProto::OK); @@ -32,7 +32,7 @@ void Test() { auto checkReadable = [&] { TActorId sender = runtime->AllocateEdgeActor(1); runtime->WrapInActorContext(sender, [&] { - SendToBSProxy(sender, info->GroupID, new TEvBlobStorage::TEvGet(id, 0, 0, TInstant::Max(), + SendToBSProxy(sender, info->GroupID.GetRawId(), new TEvBlobStorage::TEvGet(id, 0, 0, TInstant::Max(), NKikimrBlobStorage::EGetHandleClass::FastRead)); }); auto res = env.WaitForEdgeActorEvent(sender); diff --git a/ydb/core/blobstorage/ut_blobstorage/sync.cpp b/ydb/core/blobstorage/ut_blobstorage/sync.cpp index d092eac9b9ce..65867254e804 100644 --- a/ydb/core/blobstorage/ut_blobstorage/sync.cpp +++ b/ydb/core/blobstorage/ut_blobstorage/sync.cpp @@ -20,7 +20,7 @@ Y_UNIT_TEST_SUITE(BlobStorageSync) { const TString buffer = "hello, world!"; TLogoBlobID id(1, 1, 1, 0, buffer.size(), 0); runtime->WrapInActorContext(edge, [&] { - SendToBSProxy(edge, info->GroupID, new TEvBlobStorage::TEvPut(id, buffer, TInstant::Max())); + SendToBSProxy(edge, info->GroupID.GetRawId(), new TEvBlobStorage::TEvPut(id, buffer, TInstant::Max())); }); auto res = env.WaitForEdgeActorEvent(edge, false); UNIT_ASSERT_VALUES_EQUAL(res->Get()->Status, NKikimrProto::OK); @@ -71,7 +71,7 @@ Y_UNIT_TEST_SUITE(BlobStorageSync) { auto blobsInitial = collectBlobInfo(); runtime->WrapInActorContext(edge, [&] { - SendToBSProxy(edge, info->GroupID, new TEvBlobStorage::TEvCollectGarbage(id.TabletID(), id.Generation(), + SendToBSProxy(edge, info->GroupID.GetRawId(), new TEvBlobStorage::TEvCollectGarbage(id.TabletID(), id.Generation(), 0, id.Channel(), true, id.Generation(), id.Step(), new TVector(1, id), nullptr, TInstant::Max(), false)); }); @@ -83,7 +83,7 @@ Y_UNIT_TEST_SUITE(BlobStorageSync) { runtime->WrapInActorContext(edge, [&] { // send the sole do not keep flag - SendToBSProxy(edge, info->GroupID, new TEvBlobStorage::TEvCollectGarbage(id.TabletID(), 0, 0, 0, false, 0, + SendToBSProxy(edge, info->GroupID.GetRawId(), new TEvBlobStorage::TEvCollectGarbage(id.TabletID(), 0, 0, 0, false, 0, 0, nullptr, new TVector(1, id), TInstant::Max(), false)); }); res1 = env.WaitForEdgeActorEvent(edge, false); diff --git a/ydb/core/blobstorage/ut_blobstorage/ut_helpers.h b/ydb/core/blobstorage/ut_blobstorage/ut_helpers.h index 5fb44fa60ab1..517dc0605ce4 100644 --- a/ydb/core/blobstorage/ut_blobstorage/ut_helpers.h +++ b/ydb/core/blobstorage/ut_blobstorage/ut_helpers.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include namespace NKikimr { @@ -9,11 +10,12 @@ TString MakeData(ui32 dataSize); class TInflightActor : public TActorBootstrapped { public: + using TGroupId = TIdWrapper; struct TSettings { ui32 Requests; ui32 MaxInFlight; TDuration Delay = TDuration::Zero(); - ui32 GroupId = 0; + TGroupId GroupId = TGroupId::Zero(); ui32 GroupGeneration = 1; }; @@ -21,14 +23,14 @@ class TInflightActor : public TActorBootstrapped { TInflightActor(TSettings settings) : RequestsToSend(settings.Requests) , RequestInFlight(settings.MaxInFlight) - , GroupId(settings.GroupId) + , GroupId(settings.GroupId.GetRawId()) , Settings(settings) {} virtual ~TInflightActor() = default; - void SetGroupId(ui32 groupId) { - GroupId = groupId; + void SetGroupId(TGroupId groupId) { + GroupId = groupId.GetRawId(); } void Bootstrap(const TActorContext&/* ctx*/) { diff --git a/ydb/core/blobstorage/ut_group/main.cpp b/ydb/core/blobstorage/ut_group/main.cpp index 81b1266c5bdc..c9faa90debab 100644 --- a/ydb/core/blobstorage/ut_group/main.cpp +++ b/ydb/core/blobstorage/ut_group/main.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -328,7 +329,7 @@ class TTestEnv { } // update group info for proxy - runtime.Send(new IEventHandle(MakeBlobStorageProxyID(Info->GroupID), TActorId(), + runtime.Send(new IEventHandle(MakeBlobStorageProxyID(Info->GroupID.GetRawId()), TActorId(), new TEvBlobStorage::TEvConfigureProxy(Info, StoragePoolCounters)), 1); } @@ -378,7 +379,7 @@ class TTestEnv { const ui32 vdiskSlotId = ++NextVDiskSlotId[std::make_tuple(nodeId, pdiskId)]; const TActorId& vdiskActorId = MakeBlobStorageVDiskID(nodeId, pdiskId, vdiskSlotId); vdiskActorIds.push_back(vdiskActorId); - const TVDiskID vdiskId(GroupId, 1, 0, i, 0); + const TVDiskID vdiskId(TIdWrapper::FromValue(GroupId), 1, 0, i, 0); Disks.push_back(TDiskRecord{ vdiskId, serviceId, diff --git a/ydb/core/blobstorage/ut_pdiskfit/lib/basic_test.h b/ydb/core/blobstorage/ut_pdiskfit/lib/basic_test.h index c555342b3799..531c26ce3411 100644 --- a/ydb/core/blobstorage/ut_pdiskfit/lib/basic_test.h +++ b/ydb/core/blobstorage/ut_pdiskfit/lib/basic_test.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -60,7 +61,7 @@ class TBasicTest : public TActorBootstrapped { CreatePDiskActor(ctx); TVector actors; for (ui32 i = 0; i < NumVDisks; ++i) { - TVDiskID vdiskId(i, 0, 0, 0, 0); + TVDiskID vdiskId(TIdWrapper::FromValue(i), 0, 0, 0, 0); TFakeVDiskParams params; if (InduceLogSplicing) { params.LogCutProbability = 1e-3; diff --git a/ydb/core/blobstorage/ut_vdisk/lib/prepare.cpp b/ydb/core/blobstorage/ut_vdisk/lib/prepare.cpp index e4887900c8f5..9f5a9349ed6a 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/prepare.cpp +++ b/ydb/core/blobstorage/ut_vdisk/lib/prepare.cpp @@ -1,6 +1,7 @@ #include "prepare.h" #include +#include #include #include #include @@ -8,7 +9,6 @@ #include #include - #include #include @@ -245,7 +245,7 @@ bool TDefaultVDiskSetup::SetUp(TAllVDisks::TVDiskInstance &vdisk, TAllPDisks *pd ui32 pDiskID, ui32 slotId, bool runRepl, ui64 initOwnerRound) { TOnePDisk &pdisk = pdisks->Get(pDiskID); vdisk.ActorID = MakeBlobStorageVDiskID(1, id + 1, 0); - vdisk.VDiskID = TVDiskID(0, 1, 0, d, j); + vdisk.VDiskID = TVDiskID(TIdWrapper::Zero(), 1, 0, d, j); NKikimr::TVDiskConfig::TBaseInfo baseInfo(vdisk.VDiskID, pdisk.PDiskActorID, pdisk.PDiskGuid, pdisk.PDiskID, NKikimr::NPDisk::DEVICE_TYPE_ROT, slotId, diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_context.h b/ydb/core/blobstorage/vdisk/common/vdisk_context.h index bcd217cbaf30..6d34d63cbd7e 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_context.h +++ b/ydb/core/blobstorage/vdisk/common/vdisk_context.h @@ -9,6 +9,7 @@ #include "vdisk_outofspace.h" #include "vdisk_histograms.h" #include "vdisk_mongroups.h" +#include #include #include #include @@ -34,6 +35,7 @@ namespace NKikimr { ///////////////////////////////////////////////////////////////////////////////////////// class TVDiskContext : public TBSProxyContext { public: + using TGroupId = TIdWrapper; // ActorId of the main VDisk actor (currently ActorId of SkeletonFront) const TActorId VDiskActorId; const std::shared_ptr Top; @@ -43,7 +45,7 @@ namespace NKikimr { NVDiskMon::THistograms Histograms; std::shared_ptr IFaceMonGroup; // Self VDisk related info - const ui32 GroupId; + const TGroupId GroupId; const TVDiskIdShort ShortSelfVDisk; const TString VDiskLogPrefix; const ui32 NodeId; diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_events.h b/ydb/core/blobstorage/vdisk/common/vdisk_events.h index b714f2199e21..183e832df6f9 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_events.h +++ b/ydb/core/blobstorage/vdisk/common/vdisk_events.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -44,6 +45,7 @@ namespace NKikimr { namespace NBackpressure { + enum class EQueueClientType : ui32 { None, ReplJob, @@ -2934,7 +2936,7 @@ namespace NKikimr { struct TEvBlobStorage::TEvConfigureProxy : public TEventLocal - { + { TIntrusivePtr Info; TIntrusivePtr StoragePoolCounters; @@ -2963,11 +2965,12 @@ namespace NKikimr { }; struct TEvBlobStorage::TEvUpdateGroupInfo : TEventLocal { - const ui32 GroupId; + using TGroupId = TIdWrapper; + const TGroupId GroupId; const ui32 GroupGeneration; std::optional GroupInfo; - TEvUpdateGroupInfo(ui32 groupId, ui32 groupGeneration, std::optional groupInfo) + TEvUpdateGroupInfo(TGroupId groupId, ui32 groupGeneration, std::optional groupInfo) : GroupId(groupId) , GroupGeneration(groupGeneration) , GroupInfo(std::move(groupInfo)) diff --git a/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_ut.cpp b/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_ut.cpp index 82cf659f5aca..6de33755af6e 100644 --- a/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_ut.cpp +++ b/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_ut.cpp @@ -14,11 +14,11 @@ namespace NKikimr { Y_UNIT_TEST(Ingress) { TBlobStorageGroupInfo groupInfo(TBlobStorageGroupType::ErasureMirror3, 2, 4); - - TVDiskID vdisk01 = TVDiskID(0, 1, 0, 0, 1); - TVDiskID vdisk10 = TVDiskID(0, 1, 0, 1, 0); - TVDiskID vdisk21 = TVDiskID(0, 1, 0, 2, 1); - TVDiskID vdisk30 = TVDiskID(0, 1, 0, 3, 0); + using TGroupId = TIdWrapper; + TVDiskID vdisk01 = TVDiskID(TGroupId::Zero(), 1, 0, 0, 1); + TVDiskID vdisk10 = TVDiskID(TGroupId::Zero(), 1, 0, 1, 0); + TVDiskID vdisk21 = TVDiskID(TGroupId::Zero(), 1, 0, 2, 1); + TVDiskID vdisk30 = TVDiskID(TGroupId::Zero(), 1, 0, 3, 0); TLogoBlobID lb1(0, 0, 0, 0, 0, 0); @@ -59,12 +59,12 @@ namespace NKikimr { TBlobStorageGroupInfo groupInfo(TBlobStorageGroupType::ErasureMirror3, 2, 4); TLogoBlobID lb1(78364, 2, 763, 0, 0, 0); STR << "INFO: " << TIngress::PrintVDisksForLogoBlob(&groupInfo, lb1) << "\n"; - + using TGroupId = TIdWrapper; // subgroup - TVDiskID vdisk01 = TVDiskID(0, 1, 0, 0, 1); - TVDiskID vdisk10 = TVDiskID(0, 1, 0, 1, 0); - TVDiskID vdisk21 = TVDiskID(0, 1, 0, 2, 1); - TVDiskID vdisk30 = TVDiskID(0, 1, 0, 3, 0); + TVDiskID vdisk01 = TVDiskID(TGroupId::Zero(), 1, 0, 0, 1); + TVDiskID vdisk10 = TVDiskID(TGroupId::Zero(), 1, 0, 1, 0); + TVDiskID vdisk21 = TVDiskID(TGroupId::Zero(), 1, 0, 2, 1); + TVDiskID vdisk30 = TVDiskID(TGroupId::Zero(), 1, 0, 3, 0); // correspondings parts // main @@ -288,7 +288,7 @@ namespace NKikimr { Y_UNIT_TEST(IngressCacheMirror3) { TBlobStorageGroupInfo info(TBlobStorageGroupType::ErasureMirror3, 2, 4); - TVDiskID vdisk(0, 1, 0, 1 /*domain*/, 0 /*vdisk*/); + TVDiskID vdisk(TIdWrapper::Zero(), 1, 0, 1 /*domain*/, 0 /*vdisk*/); TIngressCachePtr cache = TIngressCache::Create(info.PickTopology(), vdisk); UNIT_ASSERT(cache->VDiskOrderNum == 2); @@ -303,7 +303,7 @@ namespace NKikimr { Y_UNIT_TEST(IngressCache4Plus2) { TBlobStorageGroupInfo info(TBlobStorageGroupType::Erasure4Plus2Block, 2, 8); - TVDiskID vdisk(0, 1, 0, 3 /*domain*/, 1 /*vdisk*/); + TVDiskID vdisk(TIdWrapper::Zero(), 1, 0, 3 /*domain*/, 1 /*vdisk*/); TIngressCachePtr cache = TIngressCache::Create(info.PickTopology(), vdisk); UNIT_ASSERT(cache->VDiskOrderNum == 7); @@ -317,7 +317,7 @@ namespace NKikimr { Y_UNIT_TEST(BarrierIngressQuorumBasicMirror3_4_2) { TBlobStorageGroupInfo info(TBlobStorageGroupType::ErasureMirror3, 2, 4); - TVDiskID vdisk(0, 1, 0, 1 /*domain*/, 0 /*vdisk*/); + TVDiskID vdisk(TIdWrapper::Zero(), 1, 0, 1 /*domain*/, 0 /*vdisk*/); TIngressCachePtr cache = TIngressCache::Create(info.PickTopology(), vdisk); TBarrierIngress i1(2); @@ -356,7 +356,7 @@ namespace NKikimr { Y_UNIT_TEST(BarrierIngressQuorumBasic4Plus2_8_1) { TBlobStorageGroupInfo info(TBlobStorageGroupType::Erasure4Plus2Block, 1, 8); - TVDiskID vdisk(0, 1, 0, 4 /*domain*/, 0 /*vdisk*/); + TVDiskID vdisk(TIdWrapper::Zero(), 1, 0, 4 /*domain*/, 0 /*vdisk*/); TIngressCachePtr cache = TIngressCache::Create(info.PickTopology(), vdisk); TBarrierIngress i1(2); @@ -399,17 +399,18 @@ namespace NKikimr { Y_UNIT_TEST(BarrierIngressQuorumMirror3) { TBlobStorageGroupInfo info(TBlobStorageGroupType::ErasureMirror3, 2, 4); - TVDiskID vdisk(0, 1, 0, 1 /*domain*/, 0 /*vdisk*/); + using TGroupId = TIdWrapper; + TVDiskID vdisk(TGroupId::Zero(), 1, 0, 1 /*domain*/, 0 /*vdisk*/); TIngressCachePtr cache = TIngressCache::Create(info.PickTopology(), vdisk); - TVDiskID vdisk00 = TVDiskID(0, 1, 0, 0, 0); - TVDiskID vdisk01 = TVDiskID(0, 1, 0, 0, 1); - TVDiskID vdisk10 = TVDiskID(0, 1, 0, 1, 0); - TVDiskID vdisk11 = TVDiskID(0, 1, 0, 1, 1); - TVDiskID vdisk20 = TVDiskID(0, 1, 0, 2, 0); - TVDiskID vdisk21 = TVDiskID(0, 1, 0, 2, 1); - TVDiskID vdisk30 = TVDiskID(0, 1, 0, 3, 0); - TVDiskID vdisk31 = TVDiskID(0, 1, 0, 3, 1); + TVDiskID vdisk00 = TVDiskID(TGroupId::Zero(), 1, 0, 0, 0); + TVDiskID vdisk01 = TVDiskID(TGroupId::Zero(), 1, 0, 0, 1); + TVDiskID vdisk10 = TVDiskID(TGroupId::Zero(), 1, 0, 1, 0); + TVDiskID vdisk11 = TVDiskID(TGroupId::Zero(), 1, 0, 1, 1); + TVDiskID vdisk20 = TVDiskID(TGroupId::Zero(), 1, 0, 2, 0); + TVDiskID vdisk21 = TVDiskID(TGroupId::Zero(), 1, 0, 2, 1); + TVDiskID vdisk30 = TVDiskID(TGroupId::Zero(), 1, 0, 3, 0); + TVDiskID vdisk31 = TVDiskID(TGroupId::Zero(), 1, 0, 3, 1); UNIT_ASSERT(info.GetOrderNumber(vdisk00) == 0); UNIT_ASSERT(info.GetOrderNumber(vdisk01) == 1); diff --git a/ydb/core/blobstorage/vdisk/ingress/defs.h b/ydb/core/blobstorage/vdisk/ingress/defs.h index 7e6b1bb0c1e9..2fb44af134b4 100644 --- a/ydb/core/blobstorage/vdisk/ingress/defs.h +++ b/ydb/core/blobstorage/vdisk/ingress/defs.h @@ -1,6 +1,7 @@ #pragma once // unique tag to fix pragma once gcc glueing: ./ydb/core/blobstorage/vdisk/ingress/defs.h #include +#include #include #include #include diff --git a/ydb/core/blobstorage/vdisk/repl/blobstorage_hullrepljob.cpp b/ydb/core/blobstorage/vdisk/repl/blobstorage_hullrepljob.cpp index 58a54e939d02..f02e1a7ef68a 100644 --- a/ydb/core/blobstorage/vdisk/repl/blobstorage_hullrepljob.cpp +++ b/ydb/core/blobstorage/vdisk/repl/blobstorage_hullrepljob.cpp @@ -699,7 +699,7 @@ namespace NKikimr { auto ev = std::make_unique(queries, numItems, TInstant::Max(), NKikimrBlobStorage::EGetHandleClass::AsyncRead); ev->PhantomCheck = true; - SendToBSProxy(SelfId(), GInfo->GroupID, ev.release(), cookie); + SendToBSProxy(SelfId(), GInfo->GroupID.GetRawId(), ev.release(), cookie); } } diff --git a/ydb/core/blobstorage/vdisk/repl/blobstorage_replrecoverymachine_ut.cpp b/ydb/core/blobstorage/vdisk/repl/blobstorage_replrecoverymachine_ut.cpp index fcc5e1c923e0..07034452ef18 100644 --- a/ydb/core/blobstorage/vdisk/repl/blobstorage_replrecoverymachine_ut.cpp +++ b/ydb/core/blobstorage/vdisk/repl/blobstorage_replrecoverymachine_ut.cpp @@ -1,6 +1,7 @@ #include "blobstorage_replrecoverymachine.h" #include +#include #include #include #include @@ -64,7 +65,7 @@ namespace NKikimr { baseInfo.VDiskIdShort = TVDiskIdShort(vdisks[0]); auto vdiskCfg = MakeIntrusive(baseInfo); auto counters = MakeIntrusive<::NMonitoring::TDynamicCounters>(); - auto vctx = MakeIntrusive(TActorId(), info->PickTopology(), counters, TVDiskID(0, 1, 0, 0, 0), + auto vctx = MakeIntrusive(TActorId(), info->PickTopology(), counters, TVDiskID(TIdWrapper::FromValue(0), 1, 0, 0, 0), nullptr, NPDisk::DEVICE_TYPE_UNKNOWN); auto hugeBlobCtx = std::make_shared(nullptr, true); auto replCtx = std::make_shared( diff --git a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp index 20ba724ce1b1..01e97ad47339 100644 --- a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp +++ b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp @@ -520,7 +520,7 @@ namespace NKikimr { } TLogoBlobID firstBlobId = LogoBlobIDFromLogoBlobID(record.GetItems(0).GetBlobID()); - LWTRACK(VDiskSkeletonVMultiPutRecieved, ev->Get()->Orbit, VCtx->NodeId, VCtx->GroupId, + LWTRACK(VDiskSkeletonVMultiPutRecieved, ev->Get()->Orbit, VCtx->NodeId, VCtx->GroupId.GetRawId(), VCtx->Top->GetFailDomainOrderNumber(VCtx->ShortSelfVDisk), firstBlobId.TabletID(), ev->Get()->GetSumBlobSize()); @@ -686,7 +686,7 @@ namespace NKikimr { TInstant now = TAppData::TimeProvider->Now(); NKikimrBlobStorage::TEvVPut &record = ev->Get()->Record; const TLogoBlobID id = LogoBlobIDFromLogoBlobID(record.GetBlobID()); - LWTRACK(VDiskSkeletonVPutRecieved, ev->Get()->Orbit, VCtx->NodeId, VCtx->GroupId, + LWTRACK(VDiskSkeletonVPutRecieved, ev->Get()->Orbit, VCtx->NodeId, VCtx->GroupId.GetRawId(), VCtx->Top->GetFailDomainOrderNumber(VCtx->ShortSelfVDisk), id.TabletID(), id.BlobSize()); TVPutInfo info(id, ev->Get()->GetBuffer(), record.MutableExtraBlockChecks(), std::move(ev->TraceId)); const ui64 bufSize = info.Buffer.GetSize(); diff --git a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonerr.h b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonerr.h index fbca16782a7d..fc77f756829e 100644 --- a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonerr.h +++ b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonerr.h @@ -240,27 +240,27 @@ namespace NKikimr { { if constexpr (std::is_same_v) { TLogoBlobID id = LogoBlobIDFromLogoBlobID(ev->Get()->Record.GetOriginalBlobId()); - LWTRACK(VDiskSkeletonFrontVMovedPatchRecieved, ev->Get()->Orbit, vctx->NodeId, vctx->GroupId, + LWTRACK(VDiskSkeletonFrontVMovedPatchRecieved, ev->Get()->Orbit, vctx->NodeId, vctx->GroupId.GetRawId(), vctx->Top->GetFailDomainOrderNumber(vctx->ShortSelfVDisk), id.TabletID(), id.BlobSize()); } if constexpr (std::is_same_v) { TLogoBlobID id = LogoBlobIDFromLogoBlobID(ev->Get()->Record.GetOriginalBlobId()); - LWTRACK(VDiskSkeletonFrontVPatchStartRecieved, ev->Get()->Orbit, vctx->NodeId, vctx->GroupId, + LWTRACK(VDiskSkeletonFrontVPatchStartRecieved, ev->Get()->Orbit, vctx->NodeId, vctx->GroupId.GetRawId(), vctx->Top->GetFailDomainOrderNumber(vctx->ShortSelfVDisk), id.TabletID(), id.BlobSize()); } if constexpr (std::is_same_v) { TLogoBlobID id = LogoBlobIDFromLogoBlobID(ev->Get()->Record.GetOriginalPartBlobId()); - LWTRACK(VDiskSkeletonFrontVPatchDiffRecieved, ev->Get()->Orbit, vctx->NodeId, vctx->GroupId, + LWTRACK(VDiskSkeletonFrontVPatchDiffRecieved, ev->Get()->Orbit, vctx->NodeId, vctx->GroupId.GetRawId(), vctx->Top->GetFailDomainOrderNumber(vctx->ShortSelfVDisk), id.TabletID(), id.BlobSize()); } if constexpr (std::is_same_v) { TLogoBlobID id = LogoBlobIDFromLogoBlobID(ev->Get()->Record.GetOriginalPartBlobId()); - LWTRACK(VDiskSkeletonFrontVPatchXorDiffRecieved, ev->Get()->Orbit, vctx->NodeId, vctx->GroupId, + LWTRACK(VDiskSkeletonFrontVPatchXorDiffRecieved, ev->Get()->Orbit, vctx->NodeId, vctx->GroupId.GetRawId(), vctx->Top->GetFailDomainOrderNumber(vctx->ShortSelfVDisk), id.TabletID(), id.BlobSize()); } if constexpr (std::is_same_v) { TLogoBlobID id = LogoBlobIDFromLogoBlobID(ev->Get()->Record.GetBlobID()); - LWTRACK(VDiskSkeletonFrontVPutRecieved, ev->Get()->Orbit, vctx->NodeId, vctx->GroupId, + LWTRACK(VDiskSkeletonFrontVPutRecieved, ev->Get()->Orbit, vctx->NodeId, vctx->GroupId.GetRawId(), vctx->Top->GetFailDomainOrderNumber(vctx->ShortSelfVDisk), id.TabletID(), id.BlobSize()); } @@ -278,7 +278,7 @@ namespace NKikimr { const TIntrusivePtr& groupInfo) { NKikimrBlobStorage::TEvVMultiPut &record = ev->Get()->Record; - LWTRACK(VDiskSkeletonFrontVMultiPutRecieved, ev->Get()->Orbit, vctx->NodeId, vctx->GroupId, + LWTRACK(VDiskSkeletonFrontVMultiPutRecieved, ev->Get()->Orbit, vctx->NodeId, vctx->GroupId.GetRawId(), vctx->Top->GetFailDomainOrderNumber(vctx->ShortSelfVDisk), ev->Get()->Record.ItemsSize(), ev->Get()->GetBufferBytes()); const ui64 vcookie = record.GetCookie(); diff --git a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonfront.cpp b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonfront.cpp index 43f91582f9ed..44e68102499d 100644 --- a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonfront.cpp +++ b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonfront.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -677,7 +678,7 @@ namespace NKikimr { ui64 AllocateMessageId() { return NextUniqueMessageId++; } - + using TGroupId = TIdWrapper; //////////////////////////////////////////////////////////////////////// // NOTIFICATIONS //////////////////////////////////////////////////////////////////////// @@ -714,7 +715,7 @@ namespace NKikimr { const auto &bi = Config->BaseInfo; TString path = Sprintf("vdisk%09" PRIu32 "_%09" PRIu32, bi.PDiskId, bi.VDiskSlotId); TString name = Sprintf("%s VDisk%09" PRIu32 "_%09" PRIu32 " (%" PRIu32 ")", - VCtx->VDiskLogPrefix.data(), bi.PDiskId, bi.VDiskSlotId, GInfo->GroupID); + VCtx->VDiskLogPrefix.data(), bi.PDiskId, bi.VDiskSlotId, GInfo->GroupID.GetRawId()); mon->RegisterActorPage(vdisksMonPage, path, name, false, ctx.ExecutorThread.ActorSystem, ctx.SelfID); } } @@ -1317,20 +1318,20 @@ namespace NKikimr { const char* name = "Unknown"; TIntQueueClass *queue = IntQueueHugePutsBackground.get(); if constexpr (std::is_same_v) { - LWTRACK(VDiskSkeletonFrontVMovedPatchRecieved, ev->Get()->Orbit, VCtx->NodeId, VCtx->GroupId, + LWTRACK(VDiskSkeletonFrontVMovedPatchRecieved, ev->Get()->Orbit, VCtx->NodeId, VCtx->GroupId.GetRawId(), VCtx->Top->GetFailDomainOrderNumber(VCtx->ShortSelfVDisk), blob.TabletID(), blob.BlobSize()); name = "TEvVMovedPatch"; } else if constexpr (std::is_same_v) { - LWTRACK(VDiskSkeletonFrontVPatchStartRecieved, ev->Get()->Orbit, VCtx->NodeId, VCtx->GroupId, + LWTRACK(VDiskSkeletonFrontVPatchStartRecieved, ev->Get()->Orbit, VCtx->NodeId, VCtx->GroupId.GetRawId(), VCtx->Top->GetFailDomainOrderNumber(VCtx->ShortSelfVDisk), blob.TabletID(), blob.BlobSize()); queue = IntQueueFastGets.get(); name = "TEvVPatchStart"; } else if constexpr (std::is_same_v) { - LWTRACK(VDiskSkeletonFrontVPatchDiffRecieved, ev->Get()->Orbit, VCtx->NodeId, VCtx->GroupId, + LWTRACK(VDiskSkeletonFrontVPatchDiffRecieved, ev->Get()->Orbit, VCtx->NodeId, VCtx->GroupId.GetRawId(), VCtx->Top->GetFailDomainOrderNumber(VCtx->ShortSelfVDisk), blob.TabletID(), blob.BlobSize()); name = "TEvVPatchDiff"; } else if constexpr (std::is_same_v) { - LWTRACK(VDiskSkeletonFrontVPatchXorDiffRecieved, ev->Get()->Orbit, VCtx->NodeId, VCtx->GroupId, + LWTRACK(VDiskSkeletonFrontVPatchXorDiffRecieved, ev->Get()->Orbit, VCtx->NodeId, VCtx->GroupId.GetRawId(), VCtx->Top->GetFailDomainOrderNumber(VCtx->ShortSelfVDisk), blob.TabletID(), blob.BlobSize()); name = "TEvVPatchXorDiff"; } @@ -1346,7 +1347,7 @@ namespace NKikimr { const NKikimrBlobStorage::TEvVPut &record = ev->Get()->Record; const TLogoBlobID blob = LogoBlobIDFromLogoBlobID(record.GetBlobID()); - LWTRACK(VDiskSkeletonFrontVPutRecieved, ev->Get()->Orbit, VCtx->NodeId, VCtx->GroupId, + LWTRACK(VDiskSkeletonFrontVPutRecieved, ev->Get()->Orbit, VCtx->NodeId, VCtx->GroupId.GetRawId(), VCtx->Top->GetFailDomainOrderNumber(VCtx->ShortSelfVDisk), blob.TabletID(), blob.BlobSize()); if (logPutInternalQueue) { @@ -1372,7 +1373,7 @@ namespace NKikimr { const ui64 cost = VCtx->CostModel->GetCost(*ev->Get(), &logPutInternalQueue); const NKikimrBlobStorage::TEvVMultiPut &record = ev->Get()->Record; - LWTRACK(VDiskSkeletonFrontVMultiPutRecieved, ev->Get()->Orbit, VCtx->NodeId, VCtx->GroupId, + LWTRACK(VDiskSkeletonFrontVMultiPutRecieved, ev->Get()->Orbit, VCtx->NodeId, VCtx->GroupId.GetRawId(), VCtx->Top->GetFailDomainOrderNumber(VCtx->ShortSelfVDisk), record.ItemsSize(), ev->Get()->GetSumBlobSize()); @@ -1463,7 +1464,7 @@ namespace NKikimr { auto newInfo = TBlobStorageGroupInfo::Parse(record.GetRecentGroup(), nullptr, nullptr); ChangeGeneration(vdiskId, newInfo, ctx); Y_ABORT_UNLESS(vdiskId == SelfVDiskId); - const ui32 groupId = newInfo->GroupID; + const TGroupId groupId = newInfo->GroupID; const ui32 generation = newInfo->GroupGeneration; auto ev = std::make_unique(groupId, generation, *newInfo->Group); Send(MakeBlobStorageNodeWardenID(SelfId().NodeId()), ev.release()); @@ -1619,7 +1620,7 @@ namespace NKikimr { const TActorContext& ctx) { // check group id Y_ABORT_UNLESS(info->GroupID == GInfo->GroupID, "GroupId# %" PRIu32 " new GroupId# %" PRIu32, - GInfo->GroupID, info->GroupID); + GInfo->GroupID.GetRawId(), info->GroupID.GetRawId()); // check target disk id Y_ABORT_UNLESS(TVDiskIdShort(SelfVDiskId) == TVDiskIdShort(vdiskId), "Incorrect target VDiskId" @@ -2114,7 +2115,7 @@ namespace NKikimr { chain.emplace_back("storagePool", cfg->BaseInfo.StoragePoolName); // add 'group' label - const ui32 blobstorageGroupId = info->GroupID; + const ui32 blobstorageGroupId = info->GroupID.GetRawId(); chain.emplace_back("group", Sprintf("%09" PRIu32, blobstorageGroupId)); // add 'orderNumber' label (VDisk order number in the group) diff --git a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_data.cpp b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_data.cpp index f4a8b4c20c5f..420f2b18a591 100644 --- a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_data.cpp +++ b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_data.cpp @@ -412,7 +412,8 @@ namespace NKikimr { TSyncNeighbors::TOldDes des(str); n.GenericParse(des); // recover groupId and groupGen for further conversion - ui32 groupId = des.GetGroupId(); + using TGroupId = TIdWrapper; + TGroupId groupId = des.GetGroupId(); ui32 groupGen = des.GetGroupGeneration(); // serialize into current format TStringStream output; @@ -450,7 +451,8 @@ namespace NKikimr { TSyncNeighbors::TOldDes des(str); n.GenericParse(des); // recover groupId and groupGen for further conversion - ui32 groupId = des.GetGroupId(); + using TGroupId = TIdWrapper; + TGroupId groupId = des.GetGroupId(); ui32 groupGen = des.GetGroupGeneration(); // serialize into current format TStringStream output; diff --git a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_dataserdes.h b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_dataserdes.h index 21ec511e3379..f25b4975c245 100644 --- a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_dataserdes.h +++ b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_dataserdes.h @@ -1,154 +1,135 @@ #pragma once -#include "defs.h" #include "blobstorage_syncer_data.h" +#include "defs.h" namespace NKikimr { - //////////////////////////////////////////////////////////////////////////// - // TSyncNeighbors::TOldSer - //////////////////////////////////////////////////////////////////////////// - // TODO: remove it after migration to the new format - class TSyncNeighbors::TOldSer { - public: - TOldSer(IOutputStream &str, const TBlobStorageGroupInfo *info) - : Str(str) - , Info(info) - {} - - void operator() (const TValue &val) { - TVDiskID vd = Info->GetVDiskId(val.OrderNumber); - vd.Serialize(Str); - val.Get().Serialize(Str); - } - - void Finish() {} - - private: - IOutputStream &Str; - const TBlobStorageGroupInfo *Info; - }; - - //////////////////////////////////////////////////////////////////////////// - // TSyncNeighbors::TOldDes - //////////////////////////////////////////////////////////////////////////// - class TSyncNeighbors::TOldDes { - public: - TOldDes(IInputStream &str) - : Str(str) - {} - - void operator() (TValue &val) { - TVDiskID vdisk(Str); - GroupId = vdisk.GroupID; - GroupGeneration = vdisk.GroupGeneration; - Y_ABORT_UNLESS(val.VDiskIdShort == vdisk, "val.VDiskId# %s vdisk# %s", - val.VDiskIdShort.ToString().data(), vdisk.ToString().data()); - val.Get().ParseFromArcadiaStream(Str); - } - - void Finish() { - char c = '\0'; - if (Str.ReadChar(c)) - ythrow yexception() << "not eof"; - } - - ui32 GetGroupId() const { return GroupId; } - ui32 GetGroupGeneration() const { return GroupGeneration; } - - private: - IInputStream &Str; - ui32 GroupId = 0; - ui32 GroupGeneration = 0; - }; - - - //////////////////////////////////////////////////////////////////////////// - // TSyncNeighbors::TSer - //////////////////////////////////////////////////////////////////////////// - class TSyncNeighbors::TSer { - public: - TSer(IOutputStream &str, const TBlobStorageGroupInfo *info) - : LocalProto() - , Proto(&LocalProto) - , Str(&str) - , GroupId(info->GroupID) - , GroupGeneration(info->GroupGeneration) - {} - - TSer(IOutputStream &str, ui32 groupId, ui32 groupGen) - : LocalProto() - , Proto(&LocalProto) - , Str(&str) - , GroupId(groupId) - , GroupGeneration(groupGen) - {} - - TSer(NKikimrVDiskData::TSyncerEntryPoint *pb, const TBlobStorageGroupInfo *info) - : LocalProto() - , Proto(pb) - , Str(nullptr) - , GroupId(info->GroupID) - , GroupGeneration(info->GroupGeneration) - {} - - void operator() (const TValue &val) { - TVDiskID vd = TVDiskID(GroupId, GroupGeneration, val.VDiskIdShort); - auto item = Proto->AddEntries(); - VDiskIDFromVDiskID(vd, item->MutableVDiskID()); - val.Get().Serialize(*item); - } - - void Finish() { - if (Str) - Proto->SerializeToArcadiaStream(Str); - } - - private: - NKikimrVDiskData::TSyncerEntryPoint LocalProto; - NKikimrVDiskData::TSyncerEntryPoint *Proto = nullptr; - IOutputStream *Str = nullptr; - ui32 GroupId = 0; - ui32 GroupGeneration = 0; - }; - - - //////////////////////////////////////////////////////////////////////////// - // TSyncNeighbors::TDes - //////////////////////////////////////////////////////////////////////////// - class TSyncNeighbors::TDes { - public: - TDes(IInputStream &str) - : Proto(&LocalProto) - { - auto res = LocalProto.ParseFromArcadiaStream(&str); - if (!res) - ythrow yexception() << "NKikimrVDiskData::TSyncerNeighbors parse error"; - } - - TDes(const NKikimrVDiskData::TSyncerEntryPoint *pb) - : Proto(pb) - {} - - void operator() (TValue &val) { - const auto &item = Proto->GetEntries(Counter); - ++Counter; - TVDiskID vdisk = VDiskIDFromVDiskID(item.GetVDiskID()); - Y_ABORT_UNLESS(val.VDiskIdShort == TVDiskIdShort(vdisk), - "val.VDiskId# %s vdisk# %s", - val.VDiskIdShort.ToString().data(), vdisk.ToString().data()); - val.Get().Parse(item); - } - - void Finish() { - Y_ABORT_UNLESS(Counter == Proto->EntriesSize(), "Counter# %u size# %u", - Counter, unsigned(Proto->EntriesSize())); - } - - private: - NKikimrVDiskData::TSyncerEntryPoint LocalProto; - const NKikimrVDiskData::TSyncerEntryPoint *Proto = nullptr; - unsigned Counter = 0; - }; - -} // NKikimr +//////////////////////////////////////////////////////////////////////////// +// TSyncNeighbors::TOldSer +//////////////////////////////////////////////////////////////////////////// +// TODO: remove it after migration to the new format +class TSyncNeighbors::TOldSer { +public: + TOldSer(IOutputStream &str, const TBlobStorageGroupInfo *info) + : Str(str), Info(info) {} + + void operator()(const TValue &val) { + TVDiskID vd = Info->GetVDiskId(val.OrderNumber); + vd.Serialize(Str); + val.Get().Serialize(Str); + } + + void Finish() {} + +private: + IOutputStream &Str; + const TBlobStorageGroupInfo *Info; +}; + +//////////////////////////////////////////////////////////////////////////// +// TSyncNeighbors::TOldDes +//////////////////////////////////////////////////////////////////////////// +class TSyncNeighbors::TOldDes { +public: + using TGroupId = TIdWrapper; + TOldDes(IInputStream &str) : Str(str) {} + + void operator()(TValue &val) { + TVDiskID vdisk(Str); + GroupId = vdisk.GroupID; + GroupGeneration = vdisk.GroupGeneration; + Y_ABORT_UNLESS(val.VDiskIdShort == vdisk, "val.VDiskId# %s vdisk# %s", + val.VDiskIdShort.ToString().data(), vdisk.ToString().data()); + val.Get().ParseFromArcadiaStream(Str); + } + + void Finish() { + char c = '\0'; + if (Str.ReadChar(c)) + ythrow yexception() << "not eof"; + } + + TGroupId GetGroupId() const { return GroupId; } + ui32 GetGroupGeneration() const { return GroupGeneration; } + +private: + IInputStream &Str; + TGroupId GroupId = TGroupId::Zero(); + ui32 GroupGeneration = 0; +}; + +//////////////////////////////////////////////////////////////////////////// +// TSyncNeighbors::TSer +//////////////////////////////////////////////////////////////////////////// +class TSyncNeighbors::TSer { +public: + using TGroupId = TIdWrapper; + TSer(IOutputStream &str, const TBlobStorageGroupInfo *info) + : LocalProto(), Proto(&LocalProto), Str(&str), GroupId(info->GroupID), + GroupGeneration(info->GroupGeneration) {} + + TSer(IOutputStream &str, TGroupId groupId, ui32 groupGen) + : LocalProto(), Proto(&LocalProto), Str(&str), GroupId(groupId), + GroupGeneration(groupGen) {} + + TSer(NKikimrVDiskData::TSyncerEntryPoint *pb, + const TBlobStorageGroupInfo *info) + : LocalProto(), Proto(pb), Str(nullptr), GroupId(info->GroupID), + GroupGeneration(info->GroupGeneration) {} + + void operator()(const TValue &val) { + TVDiskID vd = TVDiskID(GroupId, GroupGeneration, val.VDiskIdShort); + auto item = Proto->AddEntries(); + VDiskIDFromVDiskID(vd, item->MutableVDiskID()); + val.Get().Serialize(*item); + } + + void Finish() { + if (Str) + Proto->SerializeToArcadiaStream(Str); + } + +private: + NKikimrVDiskData::TSyncerEntryPoint LocalProto; + NKikimrVDiskData::TSyncerEntryPoint *Proto = nullptr; + IOutputStream *Str = nullptr; + TGroupId GroupId = TGroupId::Zero(); + ui32 GroupGeneration = 0; +}; + +//////////////////////////////////////////////////////////////////////////// +// TSyncNeighbors::TDes +//////////////////////////////////////////////////////////////////////////// +class TSyncNeighbors::TDes { +public: + TDes(IInputStream &str) : Proto(&LocalProto) { + auto res = LocalProto.ParseFromArcadiaStream(&str); + if (!res) + ythrow yexception() << "NKikimrVDiskData::TSyncerNeighbors parse error"; + } + + TDes(const NKikimrVDiskData::TSyncerEntryPoint *pb) : Proto(pb) {} + + void operator()(TValue &val) { + const auto &item = Proto->GetEntries(Counter); + ++Counter; + TVDiskID vdisk = VDiskIDFromVDiskID(item.GetVDiskID()); + Y_ABORT_UNLESS(val.VDiskIdShort == TVDiskIdShort(vdisk), + "val.VDiskId# %s vdisk# %s", + val.VDiskIdShort.ToString().data(), vdisk.ToString().data()); + val.Get().Parse(item); + } + + void Finish() { + Y_ABORT_UNLESS(Counter == Proto->EntriesSize(), "Counter# %u size# %u", + Counter, unsigned(Proto->EntriesSize())); + } + +private: + NKikimrVDiskData::TSyncerEntryPoint LocalProto; + const NKikimrVDiskData::TSyncerEntryPoint *Proto = nullptr; + unsigned Counter = 0; +}; + +} // namespace NKikimr diff --git a/ydb/core/blobstorage/vdisk/syncer/defs.h b/ydb/core/blobstorage/vdisk/syncer/defs.h index 0c8b1b602df5..0320a24b18ba 100644 --- a/ydb/core/blobstorage/vdisk/syncer/defs.h +++ b/ydb/core/blobstorage/vdisk/syncer/defs.h @@ -2,6 +2,7 @@ // unique tag to fix pragma once gcc glueing: ./ydb/core/blobstorage/vdisk/syncer/defs.h #include #include +#include #include #include #include diff --git a/ydb/core/cms/cluster_info.cpp b/ydb/core/cms/cluster_info.cpp index 1bfa92b04e68..34642073e564 100644 --- a/ydb/core/cms/cluster_info.cpp +++ b/ydb/core/cms/cluster_info.cpp @@ -3,6 +3,7 @@ #include "node_checkers.h" #include +#include #include #include @@ -261,7 +262,7 @@ TString TVDiskInfo::PrettyItemName() const TString TVDiskInfo::GetDeviceName() const { - return Sprintf("vdisk-%u-%u-%u-%u-%u", VDiskId.GroupID, VDiskId.GroupGeneration, + return Sprintf("vdisk-%u-%u-%u-%u-%u", VDiskId.GroupID.GetRawId(), VDiskId.GroupGeneration, VDiskId.FailRealm, VDiskId.FailDomain, VDiskId.VDisk); } @@ -277,7 +278,7 @@ bool TVDiskInfo::NameToId(const TString &name, TVDiskID &id) if (size != static_cast(name.size())) return false; - id = TVDiskID(group, gen, ring, domain, vdisk); + id = TVDiskID(TIdWrapper::FromValue(group), gen, ring, domain, vdisk); return true; } @@ -502,7 +503,7 @@ void TClusterInfo::AddVDisk(const NKikimrBlobStorage::TBaseConfig::TVSlot &info) return; } - TVDiskID vdiskId(info.GetGroupId(), + TVDiskID vdiskId(TIdWrapper::FromValue(info.GetGroupId()), info.GetGroupGeneration(), info.GetFailRealmIdx(), info.GetFailDomainIdx(), @@ -1008,7 +1009,7 @@ void TClusterInfo::DebugDump(const TActorContext &ctx) const TStringStream ss; auto &group = entry.second; ss << "BSGroup {" << Endl - << " Id: " << (ui32)group.GroupId << Endl; + << " Id: " << group.GroupId << Endl; if (group.Erasure.GetErasure() == TErasureType::ErasureSpeciesCount) ss << " Erasure: UNKNOWN" << Endl; else diff --git a/ydb/core/cms/cluster_info_ut.cpp b/ydb/core/cms/cluster_info_ut.cpp index 9fc6a14cc9f7..bd86d5fa3e7b 100644 --- a/ydb/core/cms/cluster_info_ut.cpp +++ b/ydb/core/cms/cluster_info_ut.cpp @@ -60,7 +60,7 @@ TBaseConfig::TVSlot MakeVSlotConfig(ui32 nodeId, const TVDiskID &id, ui32 pdisk, vdisk.MutableVSlotId()->SetNodeId(nodeId); vdisk.MutableVSlotId()->SetPDiskId(pdisk); vdisk.MutableVSlotId()->SetVSlotId(slot); - vdisk.SetGroupId(id.GroupID); + vdisk.SetGroupId(id.GroupID.GetRawId()); vdisk.SetGroupGeneration(id.GroupGeneration); vdisk.SetFailRealmIdx(id.FailRealm); vdisk.SetFailDomainIdx(id.FailDomain); diff --git a/ydb/core/keyvalue/keyvalue_storage_read_request.cpp b/ydb/core/keyvalue/keyvalue_storage_read_request.cpp index d93ac00aa091..fbdcafcb4dbe 100644 --- a/ydb/core/keyvalue/keyvalue_storage_read_request.cpp +++ b/ydb/core/keyvalue/keyvalue_storage_read_request.cpp @@ -226,11 +226,11 @@ class TKeyValueStorageReadRequest : public TActorBootstrappedCookie]; - if (result->GroupId != batch.GroupId) { + if (result->GroupId.GetRawId() != batch.GroupId) { STLOG_WITH_ERROR_DESCRIPTION(ErrorDescription, NLog::PRI_ERROR, NKikimrServices::KEYVALUE, KV318, "Received EvGetResult from an unexpected storage group.", (KeyValue, TabletInfo->TabletID), - (GroupId, result->GroupId), + (GroupId, result->GroupId.GetRawId()), (ExpecetedGroupId, batch.GroupId), (Status, result->Status), (Deadline, IntermediateResult->Deadline.MilliSeconds()), diff --git a/ydb/core/keyvalue/keyvalue_storage_read_request_ut.cpp b/ydb/core/keyvalue/keyvalue_storage_read_request_ut.cpp index 0b795e2d3ed8..e0149c766c54 100644 --- a/ydb/core/keyvalue/keyvalue_storage_read_request_ut.cpp +++ b/ydb/core/keyvalue/keyvalue_storage_read_request_ut.cpp @@ -1,7 +1,7 @@ #include "keyvalue_storage_read_request.h" #include - +#include #include @@ -38,7 +38,7 @@ struct TBlobStorageMockState { groupId = *group.GroupId; } std::unique_ptr getResult = std::make_unique( - group.Status, get->QuerySize, groupId); + group.Status, get->QuerySize, TIdWrapper::FromValue(groupId)); getResult->Responses.Reset(new TEvBlobStorage::TEvGetResult::TResponse[get->QuerySize]); for (ui32 queryIdx = 0; queryIdx < get->QuerySize; ++queryIdx) { auto &query = get->Queries[queryIdx]; diff --git a/ydb/core/keyvalue/keyvalue_storage_request.cpp b/ydb/core/keyvalue/keyvalue_storage_request.cpp index 7ae8ea961725..341b536d1fbe 100644 --- a/ydb/core/keyvalue/keyvalue_storage_request.cpp +++ b/ydb/core/keyvalue/keyvalue_storage_request.cpp @@ -109,7 +109,7 @@ class TKeyValueStorageRequest : public TActorBootstrappedStat.PutLatencies.push_back(duration.MilliSeconds()); auto groupId = ev->Get()->GroupId; - CheckYellow(ev->Get()->StatusFlags, groupId); + CheckYellow(ev->Get()->StatusFlags, groupId.GetRawId()); NKikimrProto::EReplyStatus status = ev->Get()->Status; if (status != NKikimrProto::OK) { @@ -157,14 +157,14 @@ class TKeyValueStorageRequest : public TActorBootstrappedStatusFlags.Merge(ev->Get()->StatusFlags.Raw); wr->Latency = duration; ++WriteRequestsReplied; - IntermediateResults->Stat.GroupWrittenBytes[std::make_pair(ev->Get()->Id.Channel(), groupId)] += ev->Get()->Id.BlobSize(); - IntermediateResults->Stat.GroupWrittenIops[std::make_pair(ev->Get()->Id.Channel(), groupId)] += 1; // FIXME: count distinct blobs? + IntermediateResults->Stat.GroupWrittenBytes[std::make_pair(ev->Get()->Id.Channel(), groupId.GetRawId())] += ev->Get()->Id.BlobSize(); + IntermediateResults->Stat.GroupWrittenIops[std::make_pair(ev->Get()->Id.Channel(), groupId.GetRawId())] += 1; // FIXME: count distinct blobs? UpdateRequest(ctx); } void Handle(TEvBlobStorage::TEvPatchResult::TPtr &ev, const TActorContext &ctx) { auto groupId = ev->Get()->GroupId; - CheckYellow(ev->Get()->StatusFlags, groupId); + CheckYellow(ev->Get()->StatusFlags, groupId.GetRawId()); NKikimrProto::EReplyStatus status = ev->Get()->Status; if (status != NKikimrProto::OK) { @@ -211,8 +211,8 @@ class TKeyValueStorageRequest : public TActorBootstrappedStatusFlags.Merge(ev->Get()->StatusFlags.Raw); ++PatchRequestsReplied; - IntermediateResults->Stat.GroupWrittenBytes[std::make_pair(ev->Get()->Id.Channel(), groupId)] += ev->Get()->Id.BlobSize(); - IntermediateResults->Stat.GroupWrittenIops[std::make_pair(ev->Get()->Id.Channel(), groupId)] += 1; + IntermediateResults->Stat.GroupWrittenBytes[std::make_pair(ev->Get()->Id.Channel(), groupId.GetRawId())] += ev->Get()->Id.BlobSize(); + IntermediateResults->Stat.GroupWrittenIops[std::make_pair(ev->Get()->Id.Channel(), groupId.GetRawId())] += 1; UpdateRequest(ctx); } @@ -337,8 +337,8 @@ class TKeyValueStorageRequest : public TActorBootstrappedStat.GroupReadBytes[std::make_pair(response.Id.Channel(), groupId)] += response.Buffer.size(); - IntermediateResults->Stat.GroupReadIops[std::make_pair(response.Id.Channel(), groupId)] += 1; // FIXME: count distinct blobs? + IntermediateResults->Stat.GroupReadBytes[std::make_pair(response.Id.Channel(), groupId.GetRawId())] += response.Buffer.size(); + IntermediateResults->Stat.GroupReadIops[std::make_pair(response.Id.Channel(), groupId.GetRawId())] += 1; // FIXME: count distinct blobs? read.Value.Write(readItem.ValueOffset, std::move(response.Buffer)); } else { Y_VERIFY_DEBUG_S(response.Status != NKikimrProto::NODATA, "NODATA received for TEvGet" diff --git a/ydb/core/mind/bscontroller/cmds_storage_pool.cpp b/ydb/core/mind/bscontroller/cmds_storage_pool.cpp index 7356c0bbe76d..a6b69eb0052c 100644 --- a/ydb/core/mind/bscontroller/cmds_storage_pool.cpp +++ b/ydb/core/mind/bscontroller/cmds_storage_pool.cpp @@ -330,7 +330,7 @@ namespace NKikimr::NBsController { auto *existing = sp->MutableExistingGroups(); for (TGroupId groupId : kv.second) { - existing->AddGroupId(groupId); + existing->AddGroupId(groupId.GetRawId()); } } @@ -342,11 +342,11 @@ namespace NKikimr::NBsController { void TBlobStorageController::TConfigState::ExecuteStep(const NKikimrBlobStorage::TReassignGroupDisk& cmd, NKikimrBlobStorage::TConfigResponse::TStatus& /*status*/) { // find matching TVSlotInfo entity - const TVDiskID vdiskId(cmd.GetGroupId(), cmd.GetGroupGeneration(), cmd.GetFailRealmIdx(), + const TVDiskID vdiskId(TGroupId::FromValue(cmd.GetGroupId()), cmd.GetGroupGeneration(), cmd.GetFailRealmIdx(), cmd.GetFailDomainIdx(), cmd.GetVDiskIdx()); // validate group and generation - const TGroupInfo *group = Groups.Find(cmd.GetGroupId()); + const TGroupInfo *group = Groups.Find(TGroupId::FromValue(cmd.GetGroupId())); if (!group) { throw TExError() << "GroupId# " << cmd.GetGroupId() << " not found"; } else if (group->Generation != cmd.GetGroupGeneration()) { @@ -405,7 +405,8 @@ namespace NKikimr::NBsController { // create a list of groups to be moved const auto& m = cmd.GetExplicitGroupId(); - TVector groups(m.begin(), m.end()); + TVector groups; + std::transform(m.begin(), m.end(), std::back_inserter(groups), [](ui32 id) { return TGroupId::FromValue(id); }); if (!groups) { for (auto it = storagePoolGroups.lower_bound(originId); it != storagePoolGroups.end() && it->first == originId; ++it) { groups.push_back(it->second); @@ -541,7 +542,7 @@ namespace NKikimr::NBsController { for (const auto& [vslotId, vslot] : StaticVSlots) { auto *x = pb->AddVSlot(); vslotId.Serialize(x->MutableVSlotId()); - x->SetGroupId(vslot.VDiskId.GroupID); + x->SetGroupId(vslot.VDiskId.GroupID.GetRawId()); x->SetGroupGeneration(vslot.VDiskId.GroupGeneration); x->SetFailRealmIdx(vslot.VDiskId.FailRealm); x->SetFailDomainIdx(vslot.VDiskId.FailDomain); @@ -701,9 +702,9 @@ namespace NKikimr::NBsController { void TBlobStorageController::TConfigState::ExecuteStep(const NKikimrBlobStorage::TSanitizeGroup& cmd, NKikimrBlobStorage::TConfigResponse::TStatus& /*status*/) { ui32 groupId = cmd.GetGroupId(); SanitizingRequests.emplace(groupId); - const TGroupInfo *group = Groups.Find(groupId); + const TGroupInfo *group = Groups.Find(TGroupId::FromValue(groupId)); if (group) { - Fit.PoolsAndGroups.emplace(group->StoragePoolId, groupId); + Fit.PoolsAndGroups.emplace(group->StoragePoolId, TGroupId::FromValue(groupId)); } else { throw TExGroupNotFound(groupId); } diff --git a/ydb/core/mind/bscontroller/config.cpp b/ydb/core/mind/bscontroller/config.cpp index 6a420facff49..f0bbeb271b59 100644 --- a/ydb/core/mind/bscontroller/config.cpp +++ b/ydb/core/mind/bscontroller/config.cpp @@ -266,7 +266,7 @@ namespace NKikimr::NBsController { const TNodeId nodeId = kv.first; NKikimrBlobStorage::TNodeWardenServiceSet &service = *Services[nodeId].MutableServiceSet(); NKikimrBlobStorage::TGroupInfo &item = *service.AddGroups(); - item.SetGroupID(groupId); + item.SetGroupID(groupId.GetRawId()); item.SetEntityStatus(NKikimrBlobStorage::DESTROY); } } @@ -395,9 +395,9 @@ namespace NKikimr::NBsController { for (auto&& [base, overlay] : state.Groups.Diff()) { using Table = Schema::GroupStoragePool; if (!overlay->second) { - db.Table().Key(overlay->first).Delete(); + db.Table
().Key(overlay->first.GetRawId()).Delete(); } else if (!base || base->second->StoragePoolId != overlay->second->StoragePoolId) { - db.Table
().Key(overlay->first).Update( + db.Table
().Key(overlay->first.GetRawId()).Update( std::get<0>(overlay->second->StoragePoolId), std::get<1>(overlay->second->StoragePoolId)); } @@ -414,7 +414,7 @@ namespace NKikimr::NBsController { for (auto&& [base, overlay] : state.Groups.Diff()) { if (!overlay->second) { const TGroupId groupId = overlay->first; - db.Table().Key(groupId).Delete(); + db.Table().Key(groupId.GetRawId()).Delete(); } } @@ -422,14 +422,14 @@ namespace NKikimr::NBsController { for (auto&& [base, overlay] : state.VSlots.Diff()) { if (!overlay->second || (base && overlay->second->GroupGeneration != base->second->GroupGeneration)) { const TVDiskID& vdiskId = base->second->GetVDiskId(); - db.Table().Key(vdiskId.GroupID, vdiskId.GroupGeneration, vdiskId.FailRealm, + db.Table().Key(vdiskId.GroupID.GetRawId(), vdiskId.GroupGeneration, vdiskId.FailRealm, vdiskId.FailDomain, vdiskId.VDisk).Delete(); } } // write down NextGroupId if it has changed if (state.NextGroupId.Changed()) { - db.Table().Key(true).Update(state.NextGroupId.Get()); + db.Table().Key(true).Update(state.NextGroupId.Get().GetRawId()); } if (state.NextStoragePoolId.Changed()) { db.Table().Key(true).Update(state.NextStoragePoolId.Get()); @@ -438,7 +438,7 @@ namespace NKikimr::NBsController { db.Table().Key(true).Update(state.SerialManagementStage.Get()); } if (state.NextVirtualGroupId.Changed()) { - db.Table().Key(true).Update(state.NextVirtualGroupId.Get()); + db.Table().Key(true).Update(state.NextVirtualGroupId.Get().GetRawId()); } CommitSelfHealUpdates(state); @@ -956,7 +956,7 @@ namespace NKikimr::NBsController { void TBlobStorageController::Serialize(NKikimrBlobStorage::TBaseConfig::TVSlot *pb, const TVSlotInfo &vslot, const TVSlotFinder& finder) { Serialize(pb->MutableVSlotId(), vslot.VSlotId); - pb->SetGroupId(vslot.GroupId); + pb->SetGroupId(vslot.GroupId.GetRawId()); pb->SetGroupGeneration(vslot.GroupGeneration); pb->SetVDiskKind(NKikimrBlobStorage::TVDiskKind::EVDiskKind_Name(vslot.Kind)); pb->SetFailRealmIdx(vslot.RingIdx); @@ -980,7 +980,7 @@ namespace NKikimr::NBsController { } void TBlobStorageController::Serialize(NKikimrBlobStorage::TBaseConfig::TGroup *pb, const TGroupInfo &group) { - pb->SetGroupId(group.ID); + pb->SetGroupId(group.ID.GetRawId()); pb->SetGroupGeneration(group.Generation); pb->SetErasureSpecies(TBlobStorageGroupType::ErasureSpeciesName(group.ErasureSpecies)); for (const TVSlotInfo *vslot : group.VDisksInGroup) { @@ -1059,7 +1059,7 @@ namespace NKikimr::NBsController { void TBlobStorageController::SerializeGroupInfo(NKikimrBlobStorage::TGroupInfo *group, const TGroupInfo& groupInfo, const TString& storagePoolName, const TMaybe& scopeId) { - group->SetGroupID(groupInfo.ID); + group->SetGroupID(groupInfo.ID.GetRawId()); group->SetGroupGeneration(groupInfo.Generation); group->SetStoragePoolName(storagePoolName); diff --git a/ydb/core/mind/bscontroller/config_fit_groups.cpp b/ydb/core/mind/bscontroller/config_fit_groups.cpp index a8d4eae22ffd..4b98155c480e 100644 --- a/ydb/core/mind/bscontroller/config_fit_groups.cpp +++ b/ydb/core/mind/bscontroller/config_fit_groups.cpp @@ -54,7 +54,7 @@ namespace NKikimr { for (ui64 reserve = 0; reserve < min || (reserve - min) * 1000000 / Max(1, total) < part; ++reserve, ++total) { TGroupMapper::TGroupDefinition group; try { - AllocateOrSanitizeGroup(0, group, {}, {}, 0, false, &TGroupGeometryInfo::AllocateGroup); + AllocateOrSanitizeGroup(TGroupId::Zero(), group, {}, {}, 0, false, &TGroupGeometryInfo::AllocateGroup); } catch (const TExFitGroupError&) { throw TExError() << "group reserve constraint hit"; } @@ -69,7 +69,7 @@ namespace NKikimr { for (;;) { // obtain group local id auto& nextGroupId = State.NextGroupId.Unshare(); - const ui32 groupLocalId = nextGroupId ? TGroupID(nextGroupId).GroupLocalID() : 0; + const ui32 groupLocalId = nextGroupId.GetRawId() ? TGroupID(nextGroupId).GroupLocalID() : 0; // create new full group id TGroupID fullGroupId(EGroupConfigurationType::Dynamic, AvailabilityDomainId, groupLocalId); @@ -77,10 +77,10 @@ namespace NKikimr { ++nextFullGroupId; // write down NextGroupId - nextGroupId = nextFullGroupId.GetRaw(); + nextGroupId = TGroupId::FromValue(nextFullGroupId.GetRaw()); // exit if there is no collision - groupId = fullGroupId.GetRaw(); + groupId = TGroupId::FromValue(fullGroupId.GetRaw()); if (!State.Groups.Find(groupId)) { break; } @@ -124,7 +124,7 @@ namespace NKikimr { ui32 lifeCyclePhase = 0; TString mainKeyId = ""; TString encryptedGroupKey = ""; - ui64 groupKeyNonce = groupId; // For the first time use groupId, then use low 32 bits of the + ui64 groupKeyNonce = groupId.GetRawId(); // For the first time use groupId, then use low 32 bits of the // NextGroupKeyNonce to produce high 32 bits of the groupKeyNonce. TGroupInfo *groupInfo = State.Groups.ConstructInplaceNewEntry(groupId, groupId, 1, @@ -193,7 +193,7 @@ namespace NKikimr { TMap replacedSlots; i64 requiredSpace = Min(); - bool sanitizingRequest = (State.SanitizingRequests.find(groupId) != State.SanitizingRequests.end()); + bool sanitizingRequest = (State.SanitizingRequests.find(groupId.GetRawId()) != State.SanitizingRequests.end()); //////////////////////////////////////////////////////////////////////////////////////////////////////// // scan through all VSlots and find matching PDisks @@ -376,9 +376,9 @@ namespace NKikimr { if (!IgnoreGroupFailModelChecks) { // process only groups with changed content; check the failure model if (!checker.CheckFailModelForGroup(failed)) { - throw TExMayLoseData(groupId); + throw TExMayLoseData(groupId.GetRawId()); } else if (!IgnoreDegradedGroupsChecks && checker.IsDegraded(failed)) { - throw TExMayGetDegraded(groupId); + throw TExMayGetDegraded(groupId.GetRawId()); } } @@ -506,7 +506,7 @@ namespace NKikimr { TStackVec groups; for (const auto& [vslotId, vslot] : info.VSlotsOnPDisk) { if (!vslot->IsBeingDeleted()) { - groups.push_back(vslot->GroupId); + groups.push_back(vslot->GroupId.GetRawId()); } } diff --git a/ydb/core/mind/bscontroller/defs.h b/ydb/core/mind/bscontroller/defs.h index 10222948d569..85fea3a422f2 100644 --- a/ydb/core/mind/bscontroller/defs.h +++ b/ydb/core/mind/bscontroller/defs.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/ydb/core/mind/bscontroller/disk_metrics.cpp b/ydb/core/mind/bscontroller/disk_metrics.cpp index 0270e5d2705f..3f33ece06d41 100644 --- a/ydb/core/mind/bscontroller/disk_metrics.cpp +++ b/ydb/core/mind/bscontroller/disk_metrics.cpp @@ -27,7 +27,8 @@ class TBlobStorageController::TTxUpdateDiskMetrics : public TTransactionBaseVSlots) { if (std::exchange(v->MetricsDirty, false)) { - auto&& key = std::tie(v->GroupId, v->GroupGeneration, v->RingIdx, v->FailDomainIdx, v->VDiskIdx); + auto groupId = v->GroupId.GetRawId(); + auto&& key = std::tie(groupId, v->GroupGeneration, v->RingIdx, v->FailDomainIdx, v->VDiskIdx); auto value = v->Metrics; value.ClearVDiskId(); db.Table().Key(key).Update(value); diff --git a/ydb/core/mind/bscontroller/get_group.cpp b/ydb/core/mind/bscontroller/get_group.cpp index c9af06f6f17b..d743cff18dc5 100644 --- a/ydb/core/mind/bscontroller/get_group.cpp +++ b/ydb/core/mind/bscontroller/get_group.cpp @@ -35,9 +35,9 @@ class TBlobStorageController::TTxGetGroup : public TTransactionBaseReadGroups(groupIDsToRead, true, Response.get(), NodeId); auto& node = Self->GetNode(NodeId); - for (TGroupId groupId : v) { - node.GroupsRequested.insert(groupId); - Self->GroupToNode.emplace(groupId, NodeId); + for (ui32 groupId : v) { + node.GroupsRequested.insert(TGroupId::FromValue(groupId)); + Self->GroupToNode.emplace(TGroupId::FromValue(groupId), NodeId); } return true; diff --git a/ydb/core/mind/bscontroller/group_geometry_info.h b/ydb/core/mind/bscontroller/group_geometry_info.h index f0e0f1f32596..2e6e0ff14bdc 100644 --- a/ydb/core/mind/bscontroller/group_geometry_info.h +++ b/ydb/core/mind/bscontroller/group_geometry_info.h @@ -86,7 +86,7 @@ namespace NKikimr::NBsController { i64 requiredSpace) const { TString error; for (const bool requireOperational : {true, false}) { - if (mapper.AllocateGroup(groupId, group, constrainsts, replacedDisks, forbid, requiredSpace, requireOperational, error)) { + if (mapper.AllocateGroup(groupId.GetRawId(), group, constrainsts, replacedDisks, forbid, requiredSpace, requireOperational, error)) { return; } } diff --git a/ydb/core/mind/bscontroller/group_mapper.cpp b/ydb/core/mind/bscontroller/group_mapper.cpp index 65f5fe6df4e4..0aaa2ad11dc9 100644 --- a/ydb/core/mind/bscontroller/group_mapper.cpp +++ b/ydb/core/mind/bscontroller/group_mapper.cpp @@ -1152,8 +1152,8 @@ namespace NKikimr::NBsController { return Impl->FindMisplacedVDisks(group); } - std::optional TGroupMapper::TargetMisplacedVDisk(ui32 groupId, TGroupMapper::TGroupDefinition& group, + std::optional TGroupMapper::TargetMisplacedVDisk(TGroupId groupId, TGroupMapper::TGroupDefinition& group, TVDiskIdShort vdisk, TForbiddenPDisks forbid, i64 requiredSpace, bool requireOperational, TString& error) { - return Impl->TargetMisplacedVDisk(groupId, group, vdisk, std::move(forbid), requiredSpace, requireOperational, error); + return Impl->TargetMisplacedVDisk(groupId.GetRawId(), group, vdisk, std::move(forbid), requiredSpace, requireOperational, error); } } // NKikimr::NBsController diff --git a/ydb/core/mind/bscontroller/group_mapper.h b/ydb/core/mind/bscontroller/group_mapper.h index 961c5a5a4be9..96ad6941514b 100644 --- a/ydb/core/mind/bscontroller/group_mapper.h +++ b/ydb/core/mind/bscontroller/group_mapper.h @@ -130,7 +130,7 @@ namespace NKikimr { TMisplacedVDisks FindMisplacedVDisks(const TGroupDefinition& group); - std::optional TargetMisplacedVDisk(ui32 groupId, TGroupDefinition& group, TVDiskIdShort vdisk, + std::optional TargetMisplacedVDisk(TGroupId groupId, TGroupDefinition& group, TVDiskIdShort vdisk, TForbiddenPDisks forbid, i64 requiredSpace, bool requireOperational, TString& error); }; diff --git a/ydb/core/mind/bscontroller/group_mapper_ut.cpp b/ydb/core/mind/bscontroller/group_mapper_ut.cpp index d82fc325a3fb..b22922593384 100644 --- a/ydb/core/mind/bscontroller/group_mapper_ut.cpp +++ b/ydb/core/mind/bscontroller/group_mapper_ut.cpp @@ -1,5 +1,5 @@ #include - +#include #include "layout_helpers.h" #include "group_geometry_info.h" #include "group_mapper.h" @@ -297,7 +297,7 @@ class TTestContext { if (!result.Disks.empty()) { status = ESanitizeResult::FAIL; for (auto vdisk : result.Disks) { - auto target = mapper.TargetMisplacedVDisk(groupId, group.Group, vdisk, + auto target = mapper.TargetMisplacedVDisk(TIdWrapper::FromValue(groupId), group.Group, vdisk, std::move(forbid), 0, requireOperational, error); if (target) { status = ESanitizeResult::SUCCESS; diff --git a/ydb/core/mind/bscontroller/group_metrics_exchange.cpp b/ydb/core/mind/bscontroller/group_metrics_exchange.cpp index 1f24f59f3089..4e0fd7e763ae 100644 --- a/ydb/core/mind/bscontroller/group_metrics_exchange.cpp +++ b/ydb/core/mind/bscontroller/group_metrics_exchange.cpp @@ -22,23 +22,24 @@ namespace NKikimr::NBsController { NIceDb::TNiceDb db(txc.DB); for (NKikimrBlobStorage::TGroupMetrics& item : *record.MutableGroupMetrics()) { - if (TGroupInfo *group = Self->FindGroup(item.GetGroupId())) { + if (TGroupInfo *group = Self->FindGroup(TGroupId::FromValue(item.GetGroupId()))) { group->GroupMetrics = std::move(item); TString s; const bool success = group->GroupMetrics->SerializeToString(&s); Y_DEBUG_ABORT_UNLESS(success); - db.Table().Key(group->ID).Update(s); + typename TGroupId::Type groupId = group->ID.GetRawId(); + db.Table().Key(groupId).Update(s); } } if (record.GroupsToQuerySize()) { Response.reset(new TEvBlobStorage::TEvControllerGroupMetricsExchange); auto& outRecord = Response->Record; - for (const TGroupId groupId : record.GetGroupsToQuery()) { - if (TGroupInfo *group = Self->FindGroup(groupId)) { + for (const ui32 groupId : record.GetGroupsToQuery()) { + if (TGroupInfo *group = Self->FindGroup(TGroupId::FromValue(groupId))) { auto *item = outRecord.AddGroupMetrics(); - item->SetGroupId(group->ID); + item->SetGroupId(group->ID.GetRawId()); group->FillInGroupParameters(item->MutableGroupParameters()); } } diff --git a/ydb/core/mind/bscontroller/impl.h b/ydb/core/mind/bscontroller/impl.h index 3be7673d2577..7e1bf7cf29f8 100644 --- a/ydb/core/mind/bscontroller/impl.h +++ b/ydb/core/mind/bscontroller/impl.h @@ -90,7 +90,7 @@ class TBlobStorageController : public TActor, public TTa const TVSlotId VSlotId; TIndirectReferable::TPtr PDisk; // PDisk this slot resides on - TGroupId GroupId = 0; + TGroupId GroupId = TGroupId::Zero(); Table::GroupGeneration::Type GroupPrevGeneration = 0; Table::GroupGeneration::Type GroupGeneration = 0; Table::Category::Type Kind = NKikimrBlobStorage::TVDiskKind::Default; @@ -1476,8 +1476,8 @@ class TBlobStorageController : public TActor, public TTa THashMap GroupLookup; TMap> IndexGroupSpeciesToGroup; TMap Nodes; - Schema::Group::ID::Type NextGroupID = 0; - Schema::Group::ID::Type NextVirtualGroupId = 0; + Schema::Group::ID::Type NextGroupID = Schema::Group::ID::Type::Zero(); + Schema::Group::ID::Type NextVirtualGroupId = Schema::Group::ID::Type::Zero(); Schema::State::NextStoragePoolId::Type NextStoragePoolId = 0; ui32 DefaultMaxSlots = 0; ui32 PDiskSpaceMarginPromille = 0; @@ -2204,7 +2204,7 @@ class TBlobStorageController : public TActor, public TTa void CommitVirtualGroupUpdates(TConfigState& state); void StartVirtualGroupSetupMachine(TGroupInfo *group); - void StartVirtualGroupDeleteMachine(ui32 groupId, TBlobDepotDeleteQueueInfo& info); + void StartVirtualGroupDeleteMachine(TGroupId groupId, TBlobDepotDeleteQueueInfo& info); void Handle(TEvBlobStorage::TEvControllerGroupDecommittedNotify::TPtr ev); diff --git a/ydb/core/mind/bscontroller/load_everything.cpp b/ydb/core/mind/bscontroller/load_everything.cpp index c7fd459635c4..b8eb7d59a5e2 100644 --- a/ydb/core/mind/bscontroller/load_everything.cpp +++ b/ydb/core/mind/bscontroller/load_everything.cpp @@ -69,8 +69,8 @@ class TBlobStorageController::TTxLoadEverything : public TTransactionBaseNextGroupID = state.GetValue(); - Self->NextVirtualGroupId = state.GetValueOrDefault(); + Self->NextGroupID = TGroupId::FromValue(state.GetValue()); + Self->NextVirtualGroupId = TGroupId::FromValue(state.GetValueOrDefault()); Self->NextStoragePoolId = state.GetValue(); Self->NextOperationLogIndex = state.GetValueOrDefault(1); Self->DefaultMaxSlots = state.GetValue(); @@ -120,9 +120,9 @@ class TBlobStorageController::TTxLoadEverything : public TTransactionBase(); const auto boxId = groupStoragePool.GetValue(); const auto storagePoolId = groupStoragePool.GetValue(); - const bool inserted = groupToStoragePool.try_emplace(groupId, boxId, storagePoolId).second; + const bool inserted = groupToStoragePool.try_emplace(TGroupId::FromValue(groupId), boxId, storagePoolId).second; Y_ABORT_UNLESS(inserted); - Self->StoragePoolGroups.emplace(TBoxStoragePoolId(boxId, storagePoolId), groupId); + Self->StoragePoolGroups.emplace(TBoxStoragePoolId(boxId, storagePoolId), TGroupId::FromValue(groupId)); if (!groupStoragePool.Next()) { return false; } @@ -364,7 +364,7 @@ class TBlobStorageController::TTxLoadEverything : public TTransactionBase(); - Y_ABORT_UNLESS(groupId); + Y_ABORT_UNLESS(groupId.GetRawId()); auto& x = Self->AddVSlot(vslotId, pdisk, groupId, slot.GetValueOrDefault(), slot.GetValue(), slot.GetValue(), slot.GetValue(), @@ -408,7 +408,7 @@ class TBlobStorageController::TTxLoadEverything : public TTransactionBase(), table.GetValue(), + const TVDiskID key(TGroupId::FromValue(table.GetValue()), table.GetValue(), table.GetValue(), table.GetValue(), table.GetValue()); if (TVSlotInfo *slot = Self->FindVSlot(key)) { slot->Metrics = table.GetValueOrDefault(); @@ -430,7 +430,7 @@ class TBlobStorageController::TTxLoadEverything : public TTransactionBase(); + const TGroupId groupId = TGroupId::FromValue(groupLatencies.GetValue()); if (TGroupInfo *groupInfo = Self->FindGroup(groupId)) { if (groupLatencies.HaveValue()) { groupInfo->LatencyStats.PutTabletLog = TDuration::MicroSeconds(groupLatencies.GetValue()); diff --git a/ydb/core/mind/bscontroller/migrate.cpp b/ydb/core/mind/bscontroller/migrate.cpp index b70bbb9ad060..9c3fc52e7b29 100644 --- a/ydb/core/mind/bscontroller/migrate.cpp +++ b/ydb/core/mind/bscontroller/migrate.cpp @@ -65,7 +65,7 @@ class TBlobStorageController::TTxMigrate : public TTransactionBase()) { + if (!slots.GetValue().GetRawId()) { // item scheduled for deletion eraseList.push_back(slots.GetKey()); } diff --git a/ydb/core/mind/bscontroller/monitoring.cpp b/ydb/core/mind/bscontroller/monitoring.cpp index 3b6812683584..d954c559dc3d 100644 --- a/ydb/core/mind/bscontroller/monitoring.cpp +++ b/ydb/core/mind/bscontroller/monitoring.cpp @@ -323,7 +323,7 @@ class TBlobStorageController::TTxMonEvent_HealthEvents static NJson::TJsonValue ToJson(const TVDiskID& vdiskId) { NJson::TJsonValue j(NJson::JSON_MAP); - j["GroupId"] = vdiskId.GroupID; + j["GroupId"] = vdiskId.GroupID.GetRawId(); j["GroupGeneration"] = vdiskId.GroupGeneration; j["FailRealmIdx"] = vdiskId.FailRealm; j["FailDomainIdx"] = vdiskId.FailDomain; @@ -421,7 +421,7 @@ class TBlobStorageController::TTxMonEvent_HealthEvents case NKikimrBlobStorage::TConfigRequest::TCommand::kReassignGroupDisk: { const auto& cmd = q.GetReassignGroupDisk(); - const TVDiskID vdiskId(cmd.GetGroupId(), cmd.GetGroupGeneration(), + const TVDiskID vdiskId(TGroupId::FromValue(cmd.GetGroupId()), cmd.GetGroupGeneration(), cmd.GetFailRealmIdx(), cmd.GetFailDomainIdx(), cmd.GetVDiskIdx()); std::optional pdiskId; @@ -646,22 +646,23 @@ class TBlobStorageController::TTxMonEvent_SetDown : public TTransactionBaseFindGroup(GroupId); if (group == nullptr) { - Response = "{\"Error\":\"Group " + ToString(GroupId) + " not found\"}"; + Response = "{\"Error\":\"Group " + ToString(GroupId.GetRawId()) + " not found\"}"; return true; } group->Down = Down; if (Persist) { NIceDb::TNiceDb db(txc.DB); - db.Table().Key(GroupId).Update(Down); + typename TGroupId::Type groupId = GroupId.GetRawId(); + db.Table().Key(groupId).Update(Down); group->PersistedDown = Down; } - Response = "{\"GroupId\":" + ToString(GroupId) + ',' + "\"Down\":" + (Down ? "true" : "false") + "}"; + Response = "{\"GroupId\":" + ToString(GroupId.GetRawId()) + ',' + "\"Down\":" + (Down ? "true" : "false") + "}"; return true; } void Complete(const TActorContext&) override { STLOG(PRI_DEBUG, BS_CONTROLLER, BSCTXMO01, "TBlobStorageController::TTxMonEvent_SetDown", - (GroupId, GroupId), (Down, Down), (Persist, Persist), (Response, Response)); + (GroupId.GetRawId(), GroupId.GetRawId()), (Down, Down), (Persist, Persist), (Response, Response)); TActivationContext::Send(new IEventHandle(Source, Self->SelfId(), new NMon::TEvRemoteJsonInfoRes(Response))); } }; @@ -685,17 +686,17 @@ class TBlobStorageController::TTxMonEvent_GetDown : public TTransactionBaseFindGroup(GroupId)) { json = reportGroup(*group); } else { - json["Error"] = Sprintf("GroupId# %" PRIu32 " not found", GroupId); + json["Error"] = Sprintf("GroupId# %" PRIu32 " not found", GroupId.GetRawId()); } } else { for (const auto& kv : Self->GroupMap) { @@ -711,7 +712,7 @@ class TBlobStorageController::TTxMonEvent_GetDown : public TTransactionBaseSelfId(), new NMon::TEvRemoteJsonInfoRes(Response))); } @@ -875,13 +876,13 @@ bool TBlobStorageController::OnRenderAppHtmlPage(NMon::TEvRemoteHttpInfo::TPtr e } else { const TString& page = cgi.Get("page"); if (page == "SetDown") { - TGroupId groupId = FromStringWithDefault(cgi.Get("group"), 0); + ui32 groupId = FromStringWithDefault(cgi.Get("group"), 0); const bool down = FromStringWithDefault(cgi.Get("down"), 0); const bool persist = FromStringWithDefault(cgi.Get("persist"), 0); - tx.Reset(new TTxMonEvent_SetDown(ev->Sender, groupId, down, persist, this)); + tx.Reset(new TTxMonEvent_SetDown(ev->Sender, TGroupId::FromValue(groupId), down, persist, this)); } else if (page == "GetDown") { - TGroupId groupId = FromStringWithDefault(cgi.Get("group"), 0); - tx.Reset(new TTxMonEvent_GetDown(ev->Sender, groupId, this)); + ui32 groupId = FromStringWithDefault(cgi.Get("group"), 0); + tx.Reset(new TTxMonEvent_GetDown(ev->Sender, TGroupId::FromValue(groupId), this)); } else if (page == "OperationLog") { tx.Reset(new TTxMonEvent_OperationLog(ev->Sender, cgi, this)); } else if (page == "OperationLogEntry") { @@ -904,8 +905,8 @@ bool TBlobStorageController::OnRenderAppHtmlPage(NMon::TEvRemoteHttpInfo::TPtr e const ui64 storagePoolId = FromStringWithDefault(cgi.Get("StoragePoolId"), -1); RenderGroupsInStoragePool(str, TBoxStoragePoolId(boxId, storagePoolId)); } else if (page == "GroupDetail") { - const TGroupId groupId = FromStringWithDefault(cgi.Get("GroupId"), -1); - RenderGroupDetail(str, groupId); + const ui32 groupId = FromStringWithDefault(cgi.Get("GroupId"), -1); + RenderGroupDetail(str, TGroupId::FromValue(groupId)); } else if (page == "Scrub") { ScrubState.Render(str); } else if (page == "InternalTables") { diff --git a/ydb/core/mind/bscontroller/propose_group_key.cpp b/ydb/core/mind/bscontroller/propose_group_key.cpp index ed8b8b5d65dd..20f106967e9a 100644 --- a/ydb/core/mind/bscontroller/propose_group_key.cpp +++ b/ydb/core/mind/bscontroller/propose_group_key.cpp @@ -8,7 +8,7 @@ class TBlobStorageController::TTxProposeGroupKey : public TTransactionBaseGet()->Record; NodeId = proto.GetNodeId(); - GroupId = proto.GetGroupId(); + GroupId = TGroupId::FromValue(proto.GetGroupId()); LifeCyclePhase = proto.GetLifeCyclePhase(); MainKeyId = proto.GetMainKeyId(); EncryptedGroupKey = proto.GetEncryptedGroupKey(); @@ -36,23 +36,23 @@ class TBlobStorageController::TTxProposeGroupKey : public TTransactionBaseFindGroup(GroupId); - if (TGroupID(GroupId).ConfigurationType() != EGroupConfigurationType::Dynamic) { - STLOG(PRI_CRIT, BS_CONTROLLER, BSCTXPGK01, "Can't propose key for non-dynamic group", (GroupId, GroupId)); + if (TGroupID(GroupId.GetRawId()).ConfigurationType() != EGroupConfigurationType::Dynamic) { + STLOG(PRI_CRIT, BS_CONTROLLER, BSCTXPGK01, "Can't propose key for non-dynamic group", (GroupId.GetRawId(), GroupId.GetRawId())); } else if (!group) { - STLOG(PRI_CRIT, BS_CONTROLLER, BSCTXPGK02, "Can't read group info", (GroupId, GroupId)); + STLOG(PRI_CRIT, BS_CONTROLLER, BSCTXPGK02, "Can't read group info", (GroupId.GetRawId(), GroupId.GetRawId())); } else if (group->EncryptionMode.GetOrElse(0) == 0) { - STLOG(PRI_ERROR, BS_CONTROLLER, BSCTXPGK03, "Group is not encrypted", (GroupId, GroupId)); + STLOG(PRI_ERROR, BS_CONTROLLER, BSCTXPGK03, "Group is not encrypted", (GroupId.GetRawId(), GroupId.GetRawId())); } else if (group->LifeCyclePhase.GetOrElse(0) != TBlobStorageGroupInfo::ELCP_INITIAL) { STLOG(PRI_ERROR, BS_CONTROLLER, BSCTXPGK04, "Group LifeCyclePhase does not match ELCP_INITIAL", - (GroupId, GroupId), (LifeCyclePhase, group->LifeCyclePhase.GetOrElse(0))); + (GroupId.GetRawId(), GroupId.GetRawId()), (LifeCyclePhase, group->LifeCyclePhase.GetOrElse(0))); IsAnotherTxInProgress = (group->LifeCyclePhase.GetOrElse(0) == TBlobStorageGroupInfo::ELCP_IN_TRANSITION); } else if (group->MainKeyVersion.GetOrElse(0) != (MainKeyVersion - 1)) { STLOG(PRI_ERROR, BS_CONTROLLER, BSCTXPGK05, "Group MainKeyVersion does not match required MainKeyVersion", - (GroupId, GroupId), (MainKeyVersion, group->MainKeyVersion.GetOrElse(0)), + (GroupId.GetRawId(), GroupId.GetRawId()), (MainKeyVersion, group->MainKeyVersion.GetOrElse(0)), (RequiredMainKeyVersion, MainKeyVersion - 1)); } else if (EncryptedGroupKey.size() != 32 + sizeof(ui32)) { STLOG(PRI_ERROR, BS_CONTROLLER, BSCTXPGK06, "Group does not accept EncryptedGroupKey size", - (GroupId, GroupId), (EncryptedGroupKeySize, EncryptedGroupKey.size()), + (GroupId.GetRawId(), GroupId.GetRawId()), (EncryptedGroupKeySize, EncryptedGroupKey.size()), (ExpectedEncryptedGroupKeySize, 32 + sizeof(ui32))); } else { Status = prevStatus; // return old status @@ -70,7 +70,7 @@ class TBlobStorageController::TTxProposeGroupKey : public TTransactionBaseEncryptedGroupKey = EncryptedGroupKey; group->GroupKeyNonce = GroupKeyNonce; group->MainKeyVersion = MainKeyVersion; - db.Table().Key(GroupId).Update( + db.Table().Key(GroupId.GetRawId()).Update( NIceDb::TUpdate(TBlobStorageGroupInfo::ELCP_IN_USE), NIceDb::TUpdate(MainKeyId), NIceDb::TUpdate(EncryptedGroupKey), @@ -109,7 +109,7 @@ class TBlobStorageController::TTxProposeGroupKey : public TTransactionBaseNotifyNodesAwaitingKeysForGroups(GroupId); + Self->NotifyNodesAwaitingKeysForGroups(GroupId.GetRawId()); } } }; diff --git a/ydb/core/mind/bscontroller/register_node.cpp b/ydb/core/mind/bscontroller/register_node.cpp index 626ed05c1521..ac6536e8147d 100644 --- a/ydb/core/mind/bscontroller/register_node.cpp +++ b/ydb/core/mind/bscontroller/register_node.cpp @@ -269,7 +269,7 @@ class TBlobStorageController::TTxRegisterNode for (auto it = Self->VSlots.lower_bound(vslotId); it != Self->VSlots.end() && it->first.NodeId == nodeId; ++it) { Self->ReadVSlot(*it->second, Response.get()); if (!it->second->IsBeingDeleted()) { - groupIDsToRead.insert(it->second->GroupId); + groupIDsToRead.insert(it->second->GroupId.GetRawId()); } } @@ -286,7 +286,7 @@ class TBlobStorageController::TTxRegisterNode if (startedGroups.size() <= Self->GroupMap.size() / 10) { for (const auto& p : startedGroups) { - processGroup(p, Self->FindGroup(p.first)); + processGroup(p, Self->FindGroup(TGroupId::FromValue(p.first))); } } else { auto started = startedGroups.begin(); @@ -296,8 +296,8 @@ class TBlobStorageController::TTxRegisterNode TGroupInfo *group = nullptr; // scan through groups until we find matching one - for (; groupIt != Self->GroupMap.end() && groupIt->first <= started->first; ++groupIt) { - if (groupIt->first == started->first) { + for (; groupIt != Self->GroupMap.end() && groupIt->first.GetRawId() <= started->first; ++groupIt) { + if (groupIt->first.GetRawId() == started->first) { group = groupIt->second.Get(); } } @@ -333,8 +333,8 @@ class TBlobStorageController::TTxRegisterNode db.Table().Key(nodeId).Update(node.LastConnectTimestamp); for (ui32 groupId : record.GetGroups()) { - node.GroupsRequested.insert(groupId); - Self->GroupToNode.emplace(groupId, nodeId); + node.GroupsRequested.insert(TGroupId::FromValue(groupId)); + Self->GroupToNode.emplace(TGroupId::FromValue(groupId), nodeId); } return true; @@ -374,13 +374,13 @@ class TBlobStorageController::TTxUpdateNodeDisconnectTimestamp void TBlobStorageController::ReadGroups(TSet& groupIDsToRead, bool discard, TEvBlobStorage::TEvControllerNodeServiceSetUpdate *result, TNodeId nodeId) { for (auto it = groupIDsToRead.begin(); it != groupIDsToRead.end(); ) { - const TGroupId groupId = *it; + const TGroupId groupId = TGroupId::FromValue(*it); TGroupInfo *group = FindGroup(groupId); if (group || discard) { NKikimrBlobStorage::TNodeWardenServiceSet *serviceSetProto = result->Record.MutableServiceSet(); NKikimrBlobStorage::TGroupInfo *groupProto = serviceSetProto->AddGroups(); if (!group) { - groupProto->SetGroupID(groupId); + groupProto->SetGroupID(groupId.GetRawId()); groupProto->SetEntityStatus(NKikimrBlobStorage::DESTROY); } else if (group->Listable()) { const TStoragePoolInfo& info = StoragePools.at(group->StoragePoolId); diff --git a/ydb/core/mind/bscontroller/request_controller_info.cpp b/ydb/core/mind/bscontroller/request_controller_info.cpp index 7f2952f8bb88..eb94c72f9aac 100644 --- a/ydb/core/mind/bscontroller/request_controller_info.cpp +++ b/ydb/core/mind/bscontroller/request_controller_info.cpp @@ -26,7 +26,7 @@ class TBlobStorageController::TTxRequestControllerInfo : public TTransactionBase auto processGroup = [&](TGroupInfo *group) { auto *protoGroupInfo = responseRecord.AddBSGroupInfo(); - protoGroupInfo->SetGroupId(group->ID); + protoGroupInfo->SetGroupId(group->ID.GetRawId()); protoGroupInfo->SetErasureSpecies(group->ErasureSpecies); const TResourceRawValues& groupResources = group->GetResourceCurrentValues(); protoGroupInfo->SetDataSize(groupResources.DataSize); @@ -42,7 +42,7 @@ class TBlobStorageController::TTxRequestControllerInfo : public TTransactionBase }; if (requestRecord.HasGroupId()) { - if (TGroupInfo *group = Self->FindGroup(requestRecord.GetGroupId())) { + if (TGroupInfo *group = Self->FindGroup(TGroupId::FromValue(requestRecord.GetGroupId()))) { processGroup(group); } } else { diff --git a/ydb/core/mind/bscontroller/scheme.h b/ydb/core/mind/bscontroller/scheme.h index 8de4850105c5..b59b7adb6ae5 100644 --- a/ydb/core/mind/bscontroller/scheme.h +++ b/ydb/core/mind/bscontroller/scheme.h @@ -49,7 +49,7 @@ struct Schema : NIceDb::Schema { }; struct Group : Table<4> { - struct ID : Column<1, NScheme::NTypeIds::Uint32> {}; // PK + struct ID : Column<1, NScheme::NTypeIds::Uint32> { using Type = TIdWrapper; static constexpr Type Default = TIdWrapper::Zero();}; // PK struct Generation : Column<2, NScheme::NTypeIds::Uint32> {}; struct ErasureSpecies : Column<3, NScheme::NTypeIds::Uint32> { using Type = TErasureType::EErasureSpecies; }; struct Owner : Column<4, NScheme::NTypeIds::Uint64> {}; @@ -121,7 +121,7 @@ struct Schema : NIceDb::Schema { struct PDiskID : Column<2, PDisk::PDiskID::ColumnType> {}; // PK + FK PDisk.PDiskID struct VSlotID : Column<3, NScheme::NTypeIds::Uint32> {}; // PK struct Category : Column<4, NScheme::NTypeIds::Uint64> { using Type = NKikimrBlobStorage::TVDiskKind::EVDiskKind; }; - struct GroupID : Column<5, Group::ID::ColumnType> {}; // FK Group.ID + struct GroupID : Column<5, Group::ID::ColumnType> {using Type = TIdWrapper; static constexpr Type Default = TIdWrapper::Zero(); }; // FK Group.ID struct GroupGeneration : Column<6, Group::Generation::ColumnType> {}; struct RingIdx : Column<7, NScheme::NTypeIds::Uint32> {}; struct FailDomainIdx : Column<8, NScheme::NTypeIds::Uint32> {}; diff --git a/ydb/core/mind/bscontroller/select_groups.cpp b/ydb/core/mind/bscontroller/select_groups.cpp index 0c84c1f5c0f7..62a90d4c8007 100644 --- a/ydb/core/mind/bscontroller/select_groups.cpp +++ b/ydb/core/mind/bscontroller/select_groups.cpp @@ -52,7 +52,7 @@ class TBlobStorageController::TTxSelectGroups : public TTransactionBaseDown && (group->SeenOperational || !record.GetOnlySeenOperational())) { auto *reportedGroup = pb->AddGroups(); reportedGroup->SetErasureSpecies(group->ErasureSpecies); - reportedGroup->SetGroupID(group->ID); + reportedGroup->SetGroupID(group->ID.GetRawId()); reportedGroup->SetStoragePoolName(Self->StoragePools.at(group->StoragePoolId).Name); reportedGroup->SetPhysicalGroup(group->IsPhysicalGroup()); reportedGroup->SetDecommitted(group->IsDecommitted()); @@ -116,7 +116,7 @@ void TBlobStorageController::ProcessSelectGroupsQueueItem(TListFillInGroupParameters(&g); if (!hasResources()) { // any of PDisks will do diff --git a/ydb/core/mind/bscontroller/self_heal.cpp b/ydb/core/mind/bscontroller/self_heal.cpp index 59d73626a844..1d9f267c3aa6 100644 --- a/ydb/core/mind/bscontroller/self_heal.cpp +++ b/ydb/core/mind/bscontroller/self_heal.cpp @@ -170,7 +170,7 @@ namespace NKikimr::NBsController { if (VDiskToReplace) { ev->SelfHeal = true; auto *cmd = request->AddCommand()->MutableReassignGroupDisk(); - cmd->SetGroupId(VDiskToReplace->GroupID); + cmd->SetGroupId(VDiskToReplace->GroupID.GetRawId()); cmd->SetGroupGeneration(VDiskToReplace->GroupGeneration); cmd->SetFailRealmIdx(VDiskToReplace->FailRealm); cmd->SetFailDomainIdx(VDiskToReplace->FailDomain); @@ -178,7 +178,7 @@ namespace NKikimr::NBsController { } else { ev->GroupLayoutSanitizer = true; auto *cmd = request->AddCommand()->MutableSanitizeGroup(); - cmd->SetGroupId(GroupId); + cmd->SetGroupId(GroupId.GetRawId()); } Send(ControllerId, ev.Release()); @@ -930,7 +930,7 @@ namespace NKikimr::NBsController { const auto& settings = bsConfig.GetAutoconfigSettings(); const auto& ss = bsConfig.GetServiceSet(); for (const auto& group : ss.GetGroups()) { - auto& content = sh->GroupsToUpdate[group.GetGroupID()]; + auto& content = sh->GroupsToUpdate[TGroupId::FromValue(group.GetGroupID())]; const TBlobStorageGroupType gtype(static_cast(group.GetErasureSpecies())); content = TEvControllerUpdateSelfHealInfo::TGroupContent{ .Generation = group.GetGroupGeneration(), @@ -938,9 +938,9 @@ namespace NKikimr::NBsController { .Geometry = std::make_shared(gtype, settings.GetGeometry()), }; - const TVDiskID vdiskId(group.GetGroupID(), group.GetGroupGeneration(), 0, 0, 0); + const TVDiskID vdiskId(TGroupId::FromValue(group.GetGroupID()), group.GetGroupGeneration(), 0, 0, 0); for (auto it = StaticVDiskMap.lower_bound(vdiskId); it != StaticVDiskMap.end() && - it->first.GroupID == group.GetGroupID() && + it->first.GroupID.GetRawId() == group.GetGroupID() && it->first.GroupGeneration == group.GetGroupGeneration(); ++it) { const TVSlotId vslotId = it->second; auto& vdiskInfo = content->VDisks[it->first]; diff --git a/ydb/core/mind/bscontroller/stat_processor.cpp b/ydb/core/mind/bscontroller/stat_processor.cpp index 338d1f582716..8a2c8c93f06d 100644 --- a/ydb/core/mind/bscontroller/stat_processor.cpp +++ b/ydb/core/mind/bscontroller/stat_processor.cpp @@ -77,7 +77,7 @@ namespace NKikimr::NBsController { // apply new report auto& record = ev->Get()->Record; for (const NKikimrBlobStorage::TEvGroupStatReport& item : record.GetPerGroupReport()) { - const TGroupId groupId = item.GetGroupId(); + const TGroupId groupId = TGroupId::FromValue(item.GetGroupId()); auto it = Groups.find(groupId); if (it != Groups.end()) { it->second.Update(item, now, groupId, GroupCleanupSchedule); @@ -100,7 +100,7 @@ namespace NKikimr::NBsController { GroupCleanupSchedule.erase(GroupCleanupSchedule.begin(), it); // recalculate percentiles for changed groups - for (const TGroupId groupId : ids) { + for (const TGroupId& groupId : ids) { Groups[groupId].RecalculatePercentiles(); UpdatedGroupIds.insert(groupId); } diff --git a/ydb/core/mind/bscontroller/sys_view.cpp b/ydb/core/mind/bscontroller/sys_view.cpp index f37a03c6a0fa..0eaea1bea06c 100644 --- a/ydb/core/mind/bscontroller/sys_view.cpp +++ b/ydb/core/mind/bscontroller/sys_view.cpp @@ -29,11 +29,11 @@ void FillKey(NKikimrSysView::TVSlotKey* key, const TVSlotId& id) { } TGroupId TransformKey(const NKikimrSysView::TGroupKey& key) { - return key.GetGroupId(); + return TGroupId::FromValue(key.GetGroupId()); } void FillKey(NKikimrSysView::TGroupKey* key, const TGroupId& id) { - key->SetGroupId(id); + key->SetGroupId(id.GetRawId()); } TBoxStoragePoolId TransformKey(const NKikimrSysView::TStoragePoolKey& key) { @@ -326,7 +326,7 @@ void CopyInfo(NKikimrSysView::TPDiskInfo* info, const THolderSetGroupId(vdiskId.GroupID); + pb->SetGroupId(vdiskId.GroupID.GetRawId()); pb->SetGroupGeneration(vdiskId.GroupGeneration); pb->SetFailRealm(vdiskId.FailRealm); pb->SetFailDomain(vdiskId.FailDomain); @@ -469,10 +469,10 @@ void TBlobStorageController::UpdateSystemViews() { if (const auto& bsConfig = StorageConfig.GetBlobStorageConfig(); bsConfig.HasServiceSet()) { const auto& ss = bsConfig.GetServiceSet(); for (const auto& group : ss.GetGroups()) { - if (!SysViewChangedGroups.count(group.GetGroupID())) { + if (!SysViewChangedGroups.count(TGroupId::FromValue(group.GetGroupID()))) { continue; } - auto *pb = &state.Groups[group.GetGroupID()]; + auto *pb = &state.Groups[TGroupId::FromValue(group.GetGroupID())]; pb->SetGeneration(group.GetGroupGeneration()); pb->SetEncryptionMode(group.GetEncryptionMode()); pb->SetLifeCyclePhase(group.GetLifeCyclePhase()); diff --git a/ydb/core/mind/bscontroller/types.h b/ydb/core/mind/bscontroller/types.h index 0033d7223ebd..364d7132a468 100644 --- a/ydb/core/mind/bscontroller/types.h +++ b/ydb/core/mind/bscontroller/types.h @@ -24,7 +24,7 @@ namespace NKikimr { namespace NBsController { using TNodeId = Schema::Node::TKey::Type; - using TGroupId = Schema::Group::TKey::Type; + using TGroupId = Schema::Group::ID::Type; using TBoxId = ui64; using TBoxStoragePoolId = std::tuple; diff --git a/ydb/core/mind/bscontroller/update_group_latencies.cpp b/ydb/core/mind/bscontroller/update_group_latencies.cpp index cc1187bc5c70..9f8f1260c0a5 100644 --- a/ydb/core/mind/bscontroller/update_group_latencies.cpp +++ b/ydb/core/mind/bscontroller/update_group_latencies.cpp @@ -25,9 +25,9 @@ class TBlobStorageController::TTxUpdateGroupLatencies : public TTransactionBase< #define UPDATE_CELL(VALUE, COLUMN) \ if (const auto& x = stats.VALUE) { \ - db.Table().Key(groupId).Update(NIceDb::TUpdate(x->MicroSeconds())); \ + db.Table().Key(groupId.GetRawId()).Update(NIceDb::TUpdate(x->MicroSeconds())); \ } else { \ - db.Table().Key(groupId).Update(NIceDb::TNull()); \ + db.Table().Key(groupId.GetRawId()).Update(NIceDb::TNull()); \ } UPDATE_CELL(PutTabletLog, PutTabletLogLatencyUs); diff --git a/ydb/core/mind/bscontroller/update_seen_operational.cpp b/ydb/core/mind/bscontroller/update_seen_operational.cpp index 82784d3e0b0a..69a1136bf800 100644 --- a/ydb/core/mind/bscontroller/update_seen_operational.cpp +++ b/ydb/core/mind/bscontroller/update_seen_operational.cpp @@ -17,7 +17,7 @@ class TBlobStorageController::TTxUpdateSeenOperational : public TTransactionBase bool Execute(TTransactionContext &txc, const TActorContext&) override { NIceDb::TNiceDb db(txc.DB); for (const TGroupId groupId : GroupIds) { - db.Table().Key(groupId).Update(true); + db.Table().Key(groupId.GetRawId()).Update(true); Self->SysViewChangedGroups.insert(groupId); } return true; diff --git a/ydb/core/mind/bscontroller/ut_bscontroller/main.cpp b/ydb/core/mind/bscontroller/ut_bscontroller/main.cpp index aab92e4555d5..80c5ab4a553e 100644 --- a/ydb/core/mind/bscontroller/ut_bscontroller/main.cpp +++ b/ydb/core/mind/bscontroller/ut_bscontroller/main.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -233,7 +234,7 @@ struct TEnvironmentSetup { void SetupStorage() { const TActorId proxyId = MakeBlobStorageProxyID(GroupId); - Runtime->RegisterService(proxyId, Runtime->Register(CreateBlobStorageGroupProxyMockActor(GroupId), NodeId), NodeId); + Runtime->RegisterService(proxyId, Runtime->Register(CreateBlobStorageGroupProxyMockActor(TIdWrapper::FromValue(GroupId)), NodeId), NodeId); class TMock : public TActor { public: diff --git a/ydb/core/mind/bscontroller/ut_selfheal/defs.h b/ydb/core/mind/bscontroller/ut_selfheal/defs.h index 52cc5a70af4f..049ed9fdd75d 100644 --- a/ydb/core/mind/bscontroller/ut_selfheal/defs.h +++ b/ydb/core/mind/bscontroller/ut_selfheal/defs.h @@ -1,7 +1,6 @@ #pragma once #include - #include #include diff --git a/ydb/core/mind/bscontroller/ut_selfheal/env.h b/ydb/core/mind/bscontroller/ut_selfheal/env.h index 439d812eb164..2a45da34d263 100644 --- a/ydb/core/mind/bscontroller/ut_selfheal/env.h +++ b/ydb/core/mind/bscontroller/ut_selfheal/env.h @@ -5,6 +5,7 @@ #include "node_warden_mock.h" #include "timer_actor.h" #include "events.h" +#include struct TEnvironmentSetup { std::unique_ptr Runtime; @@ -180,7 +181,7 @@ struct TEnvironmentSetup { void SetupStorage() { const TActorId proxyId = MakeBlobStorageProxyID(GroupId); - Runtime->RegisterService(proxyId, Runtime->Register(CreateBlobStorageGroupProxyMockActor(GroupId), NodeId)); + Runtime->RegisterService(proxyId, Runtime->Register(CreateBlobStorageGroupProxyMockActor(TIdWrapper::FromValue(GroupId)), NodeId)); for (ui32 nodeId : Runtime->GetNodes()) { const TActorId wardenId = Runtime->Register(new TNodeWardenMock(nodeId, TabletId), nodeId); diff --git a/ydb/core/mind/bscontroller/ut_selfheal/self_heal_actor_ut.cpp b/ydb/core/mind/bscontroller/ut_selfheal/self_heal_actor_ut.cpp index f851e88a3451..5eeb37717177 100644 --- a/ydb/core/mind/bscontroller/ut_selfheal/self_heal_actor_ut.cpp +++ b/ydb/core/mind/bscontroller/ut_selfheal/self_heal_actor_ut.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -52,7 +53,7 @@ TIntrusivePtr CreateGroup() { actorIds.push_back(MakeBlobStorageVDiskID(1, 1000 + i, 1000)); } return MakeIntrusive(TBlobStorageGroupType::Erasure4Plus2Block, 1u, 0u, 1u, &actorIds, - TBlobStorageGroupInfo::EEM_NONE, TBlobStorageGroupInfo::ELCP_INITIAL, TCypherKey(), 0x82000000); + TBlobStorageGroupInfo::EEM_NONE, TBlobStorageGroupInfo::ELCP_INITIAL, TCypherKey(), TIdWrapper::FromValue(0x82000000)); } TEvControllerUpdateSelfHealInfo::TGroupContent Convert(const TIntrusivePtr& info, diff --git a/ydb/core/mind/bscontroller/virtual_group.cpp b/ydb/core/mind/bscontroller/virtual_group.cpp index ef4c759de2a7..53a2387bae0d 100644 --- a/ydb/core/mind/bscontroller/virtual_group.cpp +++ b/ydb/core/mind/bscontroller/virtual_group.cpp @@ -19,14 +19,14 @@ namespace NKikimr::NBsController { } }); } catch (const TExFound& ex) { - status.AddGroupId(ex.id); + status.AddGroupId(ex.id.GetRawId()); status.SetAlready(true); return; } // allocate group identifier auto& nextGroupId = NextVirtualGroupId.Unshare(); - TGroupID groupId(EGroupConfigurationType::Virtual, 1, nextGroupId); + TGroupID groupId(EGroupConfigurationType::Virtual, 1, nextGroupId.GetRawId()); ++nextGroupId; // determine storage pool that will contain newly created virtual group @@ -66,7 +66,7 @@ namespace NKikimr::NBsController { auto& pool = pools.at(storagePoolId); // create entry in group table - auto *group = Groups.ConstructInplaceNewEntry(groupId.GetRaw(), groupId.GetRaw(), 0u, 0u, + auto *group = Groups.ConstructInplaceNewEntry(TGroupId::FromValue(groupId.GetRaw()), TGroupId::FromValue(groupId.GetRaw()), 0u, 0u, TBlobStorageGroupType::ErasureNone, 0u, NKikimrBlobStorage::TVDiskKind::Default, pool.EncryptionMode.GetOrElse(TBlobStorageGroupInfo::EEM_NONE), TBlobStorageGroupInfo::ELCP_INITIAL, TString(), TString(), 0u, 0u, false, false, storagePoolId, 0u, 0u, 0u); @@ -90,13 +90,13 @@ namespace NKikimr::NBsController { group->CalculateGroupStatus(); NKikimrBlobDepot::TBlobDepotConfig config; - config.SetVirtualGroupId(group->ID); + config.SetVirtualGroupId(group->ID.GetRawId()); config.MutableChannelProfiles()->CopyFrom(cmd.GetChannelProfiles()); const bool success = config.SerializeToString(&group->BlobDepotConfig.ConstructInPlace()); Y_ABORT_UNLESS(success); - status.AddGroupId(group->ID); + status.AddGroupId(group->ID.GetRawId()); } void TBlobStorageController::TConfigState::ExecuteStep(const NKikimrBlobStorage::TDecommitGroups& cmd, TStatus& /*status*/) { @@ -104,8 +104,8 @@ namespace NKikimr::NBsController { throw TExError() << "TDecommitGroups.HiveId/Database is not specified"; } - for (const TGroupId groupId : cmd.GetGroupIds()) { - TGroupInfo *group = Groups.FindForUpdate(groupId); + for (const ui32 groupId : cmd.GetGroupIds()) { + TGroupInfo *group = Groups.FindForUpdate(TGroupId::FromValue(groupId)); if (!group) { throw TExGroupNotFound(groupId); } else if (group->DecommitStatus != NKikimrBlobStorage::TGroupDecommitStatus::NONE) { @@ -162,7 +162,7 @@ namespace NKikimr::NBsController { if (const TGroupInfo *poolGroup = Groups.Find(begin->second)) { numPhysicalGroups += poolGroup->IsPhysicalGroup(); } else { - throw TExGroupNotFound(begin->second) + throw TExGroupNotFound(begin->second.GetRawId()) << TErrorParams::BoxId(std::get<0>(group->StoragePoolId)) << TErrorParams::StoragePoolId(std::get<1>(group->StoragePoolId)); } @@ -189,16 +189,16 @@ namespace NKikimr::NBsController { } void TBlobStorageController::TConfigState::ExecuteStep(const NKikimrBlobStorage::TCancelVirtualGroup& cmd, TStatus& /*status*/) { - const TGroupId groupId = cmd.GetGroupId(); + const TGroupId groupId = TGroupId::FromValue(cmd.GetGroupId()); TGroupInfo *group = Groups.FindForUpdate(groupId); if (!group) { - throw TExGroupNotFound(groupId); + throw TExGroupNotFound(groupId.GetRawId()); } else if (!group->VirtualGroupState) { - throw TExError() << "group is not virtual" << TErrorParams::GroupId(groupId); + throw TExError() << "group is not virtual" << TErrorParams::GroupId(groupId.GetRawId()); } else if (auto s = group->VirtualGroupState; s != NKikimrBlobStorage::EVirtualGroupState::NEW && s != NKikimrBlobStorage::EVirtualGroupState::CREATE_FAILED) { - throw TExError() << "group is not in new/error state" << TErrorParams::GroupId(groupId); + throw TExError() << "group is not in new/error state" << TErrorParams::GroupId(groupId.GetRawId()); } else if (auto s = group->DecommitStatus; s != NKikimrBlobStorage::TGroupDecommitStatus::NONE && s != NKikimrBlobStorage::TGroupDecommitStatus::PENDING) { - throw TExError() << "group decommit status is not NONE/PENDING" << TErrorParams::GroupId(groupId); + throw TExError() << "group decommit status is not NONE/PENDING" << TErrorParams::GroupId(groupId.GetRawId()); } else { group->DecommitStatus = NKikimrBlobStorage::TGroupDecommitStatus::NONE; group->VirtualGroupState = NKikimrBlobStorage::EVirtualGroupState::DELETING; @@ -322,7 +322,7 @@ namespace NKikimr::NBsController { TVirtualGroupSetupMachine(TBlobStorageController *self, ui32 groupId, const TBlobDepotDeleteQueueInfo& info) : Self(self) , ControllerId(Self->SelfId()) - , GroupId(groupId) + , GroupId(TGroupId::FromValue(groupId)) , DeleteInfo(info) {} @@ -532,7 +532,7 @@ namespace NKikimr::NBsController { ev->Record.CopyFrom(config.GetHiveParams()); } ev->Record.SetOwner(Self->TabletID()); - ev->Record.SetOwnerIdx(GroupId); + ev->Record.SetOwnerIdx(GroupId.GetRawId()); ev->Record.SetTabletType(TTabletTypes::BlobDepot); ev->Record.ClearBindedChannels(); @@ -569,7 +569,7 @@ namespace NKikimr::NBsController { } NTabletPipe::SendData(SelfId(), pipeId, invalidateEv.release()); - NTabletPipe::SendData(SelfId(), pipeId, new TEvHive::TEvReassignOnDecommitGroup(GroupId)); + NTabletPipe::SendData(SelfId(), pipeId, new TEvHive::TEvReassignOnDecommitGroup(GroupId.GetRawId())); } void HiveDelete(TGroupInfo *group) { @@ -589,17 +589,17 @@ namespace NKikimr::NBsController { HivePipeId = Register(NTabletPipe::CreateClient(SelfId(), hiveId, NTabletPipe::TClientRetryPolicy::WithRetries())); auto ev = tabletId - ? std::make_unique(Self->TabletID(), GroupId, *tabletId, 0) - : std::make_unique(Self->TabletID(), GroupId, 0); + ? std::make_unique(Self->TabletID(), GroupId.GetRawId(), *tabletId, 0) + : std::make_unique(Self->TabletID(), GroupId.GetRawId(), 0); - STLOG(PRI_INFO, BS_CONTROLLER, BSCVG12, "sending TEvDeleteTablet", (GroupId, GroupId), + STLOG(PRI_INFO, BS_CONTROLLER, BSCVG12, "sending TEvDeleteTablet", (GroupId.GetRawId(), GroupId.GetRawId()), (HiveId, hiveId), (Msg, ev->Record)); NTabletPipe::SendData(SelfId(), HivePipeId, ev.release()); } void Handle(TEvTabletPipe::TEvClientConnected::TPtr ev) { - STLOG(PRI_DEBUG, BS_CONTROLLER, BSCVG02, "received TEvClientConnected", (GroupId, GroupId), + STLOG(PRI_DEBUG, BS_CONTROLLER, BSCVG02, "received TEvClientConnected", (GroupId.GetRawId(), GroupId.GetRawId()), (Status, ev->Get()->Status), (ClientId, ev->Get()->ClientId), (HivePipeId, HivePipeId), (BlobDepotPipeId, BlobDepotPipeId)); @@ -621,7 +621,7 @@ namespace NKikimr::NBsController { } void Handle(TEvTabletPipe::TEvClientDestroyed::TPtr ev) { - STLOG(PRI_DEBUG, BS_CONTROLLER, BSCVG03, "received TEvClientDestroyed", (GroupId, GroupId), + STLOG(PRI_DEBUG, BS_CONTROLLER, BSCVG03, "received TEvClientDestroyed", (GroupId.GetRawId(), GroupId.GetRawId()), (ClientId, ev->Get()->ClientId), (HivePipeId, HivePipeId), (BlobDepotPipeId, BlobDepotPipeId)); OnPipeError(ev->Get()->ClientId); @@ -638,12 +638,12 @@ namespace NKikimr::NBsController { } void Handle(TEvHive::TEvInvalidateStoragePoolsReply::TPtr ev) { - STLOG(PRI_INFO, BS_CONTROLLER, BSCVG06, "received TEvInvalidateStoragePoolsReply", (GroupId, GroupId), + STLOG(PRI_INFO, BS_CONTROLLER, BSCVG06, "received TEvInvalidateStoragePoolsReply", (GroupId.GetRawId(), GroupId.GetRawId()), (Msg, ev->Get()->Record)); } void Handle(TEvHive::TEvReassignOnDecommitGroupReply::TPtr ev) { - STLOG(PRI_INFO, BS_CONTROLLER, BSCVG07, "received TEvReassignOnDecommitGroupReply", (GroupId, GroupId), + STLOG(PRI_INFO, BS_CONTROLLER, BSCVG07, "received TEvReassignOnDecommitGroupReply", (GroupId.GetRawId(), GroupId.GetRawId()), (Msg, ev->Get()->Record)); if (TenantHiveInvalidateInProgress) { NTabletPipe::CloseAndForgetClient(SelfId(), TenantHivePipeId); @@ -654,7 +654,7 @@ namespace NKikimr::NBsController { } void Handle(TEvHive::TEvCreateTabletReply::TPtr ev) { - STLOG(PRI_INFO, BS_CONTROLLER, BSCVG04, "received TEvCreateTabletReply", (GroupId, GroupId), + STLOG(PRI_INFO, BS_CONTROLLER, BSCVG04, "received TEvCreateTabletReply", (GroupId.GetRawId(), GroupId.GetRawId()), (Msg, ev->Get()->Record)); NTabletPipe::CloseAndForgetClient(SelfId(), HivePipeId); @@ -686,12 +686,12 @@ namespace NKikimr::NBsController { } void Handle(TEvHive::TEvTabletCreationResult::TPtr ev) { - STLOG(PRI_INFO, BS_CONTROLLER, BSCVG05, "received TEvTabletCreationResult", (GroupId, GroupId), + STLOG(PRI_INFO, BS_CONTROLLER, BSCVG05, "received TEvTabletCreationResult", (GroupId.GetRawId(), GroupId.GetRawId()), (Msg, ev->Get()->Record)); } void Handle(TEvHive::TEvDeleteTabletReply::TPtr ev) { - STLOG(PRI_INFO, BS_CONTROLLER, BSCVG13, "received TEvDeleteTabletReply", (GroupId, GroupId), + STLOG(PRI_INFO, BS_CONTROLLER, BSCVG13, "received TEvDeleteTabletReply", (GroupId.GetRawId(), GroupId.GetRawId()), (Msg, ev->Get()->Record)); if (DeleteInfo) { OnBlobDepotDeleted(); @@ -702,7 +702,7 @@ namespace NKikimr::NBsController { void ConfigureBlobDepot() { TGroupInfo *group = GetGroup(); - STLOG(PRI_DEBUG, BS_CONTROLLER, BSCVG14, "ConfigureBlobDepot", (GroupId, group->ID)); + STLOG(PRI_DEBUG, BS_CONTROLLER, BSCVG14, "ConfigureBlobDepot", (GroupId.GetRawId(), group->ID.GetRawId())); auto& config = GetConfig(group); Y_ABORT_UNLESS(config.HasTabletId()); Y_ABORT_UNLESS(!group->BlobDepotId || group->BlobDepotId == config.GetTabletId()); @@ -716,7 +716,7 @@ namespace NKikimr::NBsController { void DeleteBlobDepot() { auto *group = GetGroup(); - STLOG(PRI_DEBUG, BS_CONTROLLER, BSCVG15, "DeleteBlobDepot", (GroupId, group->ID)); + STLOG(PRI_DEBUG, BS_CONTROLLER, BSCVG15, "DeleteBlobDepot", (GroupId.GetRawId(), group->ID.GetRawId())); Self->Execute(std::make_unique(this, [](TGroupInfo& group, TConfigState&) { if (group.VDisksInGroup) { group.VirtualGroupName = {}; @@ -734,7 +734,7 @@ namespace NKikimr::NBsController { } void OnBlobDepotDeleted() { - STLOG(PRI_DEBUG, BS_CONTROLLER, BSCVG18, "OnBlobDepotDeleted", (GroupId, GroupId)); + STLOG(PRI_DEBUG, BS_CONTROLLER, BSCVG18, "OnBlobDepotDeleted", (GroupId.GetRawId(), GroupId.GetRawId())); Self->Execute(std::make_unique(this)); } @@ -763,7 +763,7 @@ namespace NKikimr::NBsController { node.WaitingForGroups.erase(group->ID); auto ev = std::make_unique(NKikimrProto::OK, nodeId); TSet groups; - groups.insert(group->ID); + groups.insert(group->ID.GetRawId()); Self->ReadGroups(groups, false, ev.get(), nodeId); Send(MakeBlobStorageNodeWardenID(nodeId), ev.release()); } @@ -874,9 +874,9 @@ namespace NKikimr::NBsController { group->VirtualGroupSetupMachineId = RegisterWithSameMailbox(new TVirtualGroupSetupMachine(this, *group)); } - void TBlobStorageController::StartVirtualGroupDeleteMachine(ui32 groupId, TBlobDepotDeleteQueueInfo& info) { + void TBlobStorageController::StartVirtualGroupDeleteMachine(TGroupId groupId, TBlobDepotDeleteQueueInfo& info) { Y_ABORT_UNLESS(!info.VirtualGroupSetupMachineId); - info.VirtualGroupSetupMachineId = RegisterWithSameMailbox(new TVirtualGroupSetupMachine(this, groupId, info)); + info.VirtualGroupSetupMachineId = RegisterWithSameMailbox(new TVirtualGroupSetupMachine(this, groupId.GetRawId(), info)); } void TBlobStorageController::Handle(TEvBlobStorage::TEvControllerGroupDecommittedNotify::TPtr ev) { @@ -908,7 +908,7 @@ namespace NKikimr::NBsController { void Action(TConfigState& state) { const ui32 groupId = Ev->Get()->Record.GetGroupId(); - TGroupInfo *group = state.Groups.FindForUpdate(groupId); + TGroupInfo *group = state.Groups.FindForUpdate(TGroupId::FromValue(groupId)); if (!group) { std::tie(Status, ErrorReason) = std::make_tuple(NKikimrProto::ERROR, "group not found"); } else if (group->DecommitStatus == NKikimrBlobStorage::TGroupDecommitStatus::DONE) { @@ -922,7 +922,7 @@ namespace NKikimr::NBsController { group->VDisksInGroup.clear(); group->DecommitStatus = NKikimrBlobStorage::TGroupDecommitStatus::DONE; group->Topology = std::make_shared(group->Topology->GType, 0, 0, 0); - state.GroupContentChanged.insert(groupId); + state.GroupContentChanged.insert(TGroupId::FromValue(groupId)); } STLOG(PRI_INFO, BS_CONTROLLER, BSCVG10, "decommission update processed", (Status, Status), diff --git a/ydb/core/mind/table_adapter.h b/ydb/core/mind/table_adapter.h index f96e87ce876c..281d63908b90 100644 --- a/ydb/core/mind/table_adapter.h +++ b/ydb/core/mind/table_adapter.h @@ -2,7 +2,7 @@ #include #include - +#include namespace NKikimr { // inline table specifier @@ -33,6 +33,23 @@ namespace NKikimr { template struct TGetTableKeyColumn> : TGetTableKeyColumnImpl {}; + template + struct HasGetRawId : std::false_type {}; + + template + struct HasGetRawId().GetRawId())>> : std::true_type {}; + + template + auto GetValue(T& item) -> std::enable_if_t::value, decltype(item.GetRawId())> { + return item.GetRawId(); + } + + template + auto GetValue(T& item) -> std::enable_if_t::value, T> { + return item; + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // KEY MAPPER //////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -43,7 +60,7 @@ namespace NKikimr { template static auto PrepareKeyTuple(const std::tuple *items, std::tuple &&tuple) { - TMaybe::Type> value(std::get(*items)); + TMaybe::Type> value(GetValue(std::get(*items))); return TTupleKeyMapper::PrepareKeyTuple(items, std::tuple_cat(std::forward>(tuple), std::make_tuple(std::move(value)))); } @@ -104,6 +121,11 @@ namespace NKikimr { return std::make_tuple(item); } + template + auto WrapTuple(const T &item, std::enable_if_t>>* = nullptr) { + return std::make_tuple(item); + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // CELL //////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -121,6 +143,11 @@ namespace NKikimr { to.ConstructInPlace(from.GetValue()); } + template + inline void Cast(const TIdWrapper& from, TMaybe& to){ + to.ConstructInPlace(from.GetRawId()); + } + template struct TCell { typename TColumn::Type TRow::*CellPtr = nullptr; @@ -375,6 +402,11 @@ namespace NKikimr { return TKey(rowset.GetKey()); } + template + auto CreateFromRowset(const TRowset &rowset) -> decltype(TKey::FromValue(std::declval().GetKey())) { + return TKey::FromValue(rowset.GetKey()); + } + template auto CreateFromRowset(const TRowset &rowset) -> decltype(TKey::CreateFromRowset(std::declval())) { return TKey::CreateFromRowset(rowset); diff --git a/ydb/core/node_whiteboard/node_whiteboard.h b/ydb/core/node_whiteboard/node_whiteboard.h index ed208714709c..2b697e1a81ca 100644 --- a/ydb/core/node_whiteboard/node_whiteboard.h +++ b/ydb/core/node_whiteboard/node_whiteboard.h @@ -302,7 +302,7 @@ struct TEvWhiteboard{ TEvBSGroupStateUpdate() = default; TEvBSGroupStateUpdate(const TIntrusivePtr& groupInfo) { - Record.SetGroupID(groupInfo->GroupID); + Record.SetGroupID(groupInfo->GroupID.GetRawId()); Record.SetGroupGeneration(groupInfo->GroupGeneration); Record.SetErasureSpecies(groupInfo->Type.ErasureSpeciesName(groupInfo->Type.GetErasure())); if (ui32 numVDisks = groupInfo->GetTotalVDisksNum()) { diff --git a/ydb/core/tablet/tablet_req_rebuildhistory.cpp b/ydb/core/tablet/tablet_req_rebuildhistory.cpp index 5f48c1ce1453..407d4bd56693 100644 --- a/ydb/core/tablet/tablet_req_rebuildhistory.cpp +++ b/ydb/core/tablet/tablet_req_rebuildhistory.cpp @@ -459,14 +459,14 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrappedAttach(MakeHolder(msg->GroupId, msg->From, msg->To)); + IntrospectionTrace->Attach(MakeHolder(msg->GroupId.GetRawId(), msg->From, msg->To)); } Y_ABORT_UNLESS(RangesToDiscover.erase(msg->To)); for (TVector::iterator it = msg->Responses.begin(), end = msg->Responses.end(); it != end; ++it) { const TLogoBlobID &id = it->Id; - GroupReadBytes[std::make_pair(id.Channel(), msg->GroupId)] += it->Buffer.size(); - GroupReadOps[std::make_pair(id.Channel(), msg->GroupId)] += 1; + GroupReadBytes[std::make_pair(id.Channel(), msg->GroupId.GetRawId())] += it->Buffer.size(); + GroupReadOps[std::make_pair(id.Channel(), msg->GroupId.GetRawId())] += 1; NKikimrTabletBase::TTabletLogEntry logEntry; if (!logEntry.ParseFromString(it->Buffer)) { @@ -589,8 +589,8 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrappedGroupId)] += response.Buffer.size(); - GroupReadOps[std::make_pair(response.Id.Channel(), msg->GroupId)] += 1; + GroupReadBytes[std::make_pair(response.Id.Channel(), msg->GroupId.GetRawId())] += response.Buffer.size(); + GroupReadOps[std::make_pair(response.Id.Channel(), msg->GroupId.GetRawId())] += 1; break; case NKikimrProto::NODATA: BLOG_W("TTabletReqRebuildHistoryGraph::CheckReferences - NODATA for blob " << response.Id, "TRRH07"); diff --git a/ydb/core/tablet/tablet_req_writelog.cpp b/ydb/core/tablet/tablet_req_writelog.cpp index 619facd2dcd9..b102c75e5675 100644 --- a/ydb/core/tablet/tablet_req_writelog.cpp +++ b/ydb/core/tablet/tablet_req_writelog.cpp @@ -49,8 +49,8 @@ class TTabletReqWriteLog : public TActorBootstrapped { case NKikimrProto::OK: LOG_DEBUG_S(ctx, NKikimrServices::TABLET_MAIN, "Put Result: " << msg->Print(false)); - GroupWrittenBytes[std::make_pair(msg->Id.Channel(), msg->GroupId)] += msg->Id.BlobSize(); - GroupWrittenOps[std::make_pair(msg->Id.Channel(), msg->GroupId)] += 1; + GroupWrittenBytes[std::make_pair(msg->Id.Channel(), msg->GroupId.GetRawId())] += msg->Id.BlobSize(); + GroupWrittenOps[std::make_pair(msg->Id.Channel(), msg->GroupId.GetRawId())] += 1; ResponseCookies ^= ev->Cookie; diff --git a/ydb/core/tablet_flat/flat_cxx_database.h b/ydb/core/tablet_flat/flat_cxx_database.h index 4546b71175ec..9a146283b12a 100644 --- a/ydb/core/tablet_flat/flat_cxx_database.h +++ b/ydb/core/tablet_flat/flat_cxx_database.h @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -361,6 +362,22 @@ struct TConvertValue { }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// TIdWrapper conversion + +template +struct TConvertValue> { + typename NSchemeTypeMapper::Type Storage; + TTypeValue Value; + TConvertValue(const TIdWrapper & value) : Storage(value.GetRawId()), Value(Storage, TColumnType::ColumnType) {} + operator const TRawTypeValue&() const { return Value; } +}; + +template +struct TConvertValue, TRawTypeValue> { + TTypeValue Value; + TConvertValue(const TRawTypeValue & value) : Value(value) {} + operator TIdWrapper() const { return TIdWrapper::FromValue(static_cast(Value)); } +}; template struct TConvertValue { @@ -757,13 +774,10 @@ struct Schema { return *this; } - auto Key(typename KeyColumns::Type... keyValues) { - return KeyOperations(*Database, keyValues...); - } - - auto Key(const KeyValuesType& keyValues) { - return KeyOperations(*Database, keyValues); - } + template + auto Key(Keys&&... keyValues) { + return KeyOperations(*Database, std::forward(keyValues)...); + } template auto Range(Keys... keyValues) { diff --git a/ydb/core/tablet_flat/flat_ops_compact.h b/ydb/core/tablet_flat/flat_ops_compact.h index 61e1acedbeef..762ef7250f5b 100644 --- a/ydb/core/tablet_flat/flat_ops_compact.h +++ b/ydb/core/tablet_flat/flat_ops_compact.h @@ -454,7 +454,7 @@ namespace NTabletFlatExecutor { } if (ok) { - Send(Owner, new NBlockIO::TEvStat(NBlockIO::EDir::Write, NBlockIO::EPriority::Bulk, msg.GroupId, msg.Id)); + Send(Owner, new NBlockIO::TEvStat(NBlockIO::EDir::Write, NBlockIO::EPriority::Bulk, msg.GroupId.GetRawId(), msg.Id)); while (!WriteQueue.empty() && Writing < MaxFlight) { SendToBs(std::move(WriteQueue.front())); diff --git a/ydb/core/tx/columnshard/blobs_action/tier/adapter.cpp b/ydb/core/tx/columnshard/blobs_action/tier/adapter.cpp index 9d94dafe939d..5b43d79c1528 100644 --- a/ydb/core/tx/columnshard/blobs_action/tier/adapter.cpp +++ b/ydb/core/tx/columnshard/blobs_action/tier/adapter.cpp @@ -26,11 +26,12 @@ std::unique_ptr TRepliesAdapter::RebuildReplyEvent(std::uni TLogoBlobID logoBlobId; TString error; Y_ABORT_UNLESS(ev->Key); + using TGroupId = TIdWrapper; AFL_VERIFY(TLogoBlobID::Parse(logoBlobId, *ev->Key, error))("error", error)("str_blob_id", *ev->Key); if (ev->IsSuccess()) { - return std::make_unique(NKikimrProto::EReplyStatus::OK, logoBlobId, 0, Max(), 0, StorageId); + return std::make_unique(NKikimrProto::EReplyStatus::OK, logoBlobId, 0, TGroupId::FromValue(Max()), 0, StorageId); } else { - return std::make_unique(NKikimrProto::EReplyStatus::ERROR, logoBlobId, 0, Max(), 0, StorageId); + return std::make_unique(NKikimrProto::EReplyStatus::ERROR, logoBlobId, 0, TGroupId::FromValue(Max()), 0, StorageId); } } diff --git a/ydb/core/tx/columnshard/engines/writer/write_controller.cpp b/ydb/core/tx/columnshard/engines/writer/write_controller.cpp index 0b3322b955c4..4b427a43014b 100644 --- a/ydb/core/tx/columnshard/engines/writer/write_controller.cpp +++ b/ydb/core/tx/columnshard/engines/writer/write_controller.cpp @@ -4,7 +4,7 @@ namespace NKikimr::NColumnShard { void IWriteController::OnBlobWriteResult(const TEvBlobStorage::TEvPutResult& result) { - NOlap::TUnifiedBlobId blobId(result.GroupId, result.Id); + NOlap::TUnifiedBlobId blobId(result.GroupId.GetRawId(), result.Id); auto it = WaitingActions.find(result.StorageId ? result.StorageId : NOlap::IStoragesManager::DefaultStorageId); AFL_VERIFY(it != WaitingActions.end()); it->second->OnBlobWriteResult(blobId, result.Status); diff --git a/ydb/core/tx/datashard/datashard_ut_order.cpp b/ydb/core/tx/datashard/datashard_ut_order.cpp index 325352e6ecbf..32307e351b2b 100644 --- a/ydb/core/tx/datashard/datashard_ut_order.cpp +++ b/ydb/core/tx/datashard/datashard_ut_order.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include // Y_UNIT_TEST_(TWIN|QUAD) @@ -4482,7 +4483,7 @@ Y_UNIT_TEST(UncommittedReadSetAck) { for (auto& ev : capturedCommits) { auto proxy = ev->Recipient; ui32 groupId = GroupIDFromBlobStorageProxyID(proxy); - auto res = ev->Get()->MakeErrorResponse(NKikimrProto::ERROR, "Something went wrong", groupId); + auto res = ev->Get()->MakeErrorResponse(NKikimrProto::ERROR, "Something went wrong", TIdWrapper::FromValue(groupId)); runtime.Send(new IEventHandle(ev->Sender, proxy, res.release()), 1, true); } capturedCommits.clear(); diff --git a/ydb/core/tx/datashard/datashard_ut_volatile.cpp b/ydb/core/tx/datashard/datashard_ut_volatile.cpp index 8510177bec6d..0bc2ec01a1e8 100644 --- a/ydb/core/tx/datashard/datashard_ut_volatile.cpp +++ b/ydb/core/tx/datashard/datashard_ut_volatile.cpp @@ -4,6 +4,7 @@ #include "datashard_active_transaction.h" #include +#include #include namespace NKikimr { @@ -2147,7 +2148,7 @@ Y_UNIT_TEST_SUITE(DataShardVolatile) { putResponses.emplace_back(new IEventHandle( ev->Sender, ev->GetRecipientRewrite(), - msg->MakeErrorResponse(NKikimrProto::BLOCKED, "Fake blocked response", 0).release(), + msg->MakeErrorResponse(NKikimrProto::BLOCKED, "Fake blocked response", TIdWrapper::Zero()).release(), 0, ev->Cookie)); Cerr << "... dropping put " << msg->Id << Endl; @@ -2354,7 +2355,7 @@ Y_UNIT_TEST_SUITE(DataShardVolatile) { for (auto& ev : blockedPuts) { auto proxy = ev->Recipient; ui32 groupId = GroupIDFromBlobStorageProxyID(proxy); - auto res = ev->Get()->MakeErrorResponse(NKikimrProto::ERROR, "Something went wrong", groupId); + auto res = ev->Get()->MakeErrorResponse(NKikimrProto::ERROR, "Something went wrong", TIdWrapper::FromValue(groupId)); runtime.Send(new IEventHandle(ev->Sender, proxy, res.release()), 0, true); }