diff options
author | Evgenik2 <Evgenik2@users.noreply.github.com> | 2025-04-16 11:26:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-16 11:26:23 +0300 |
commit | e39c1fe3cca27babe95bf01b7ace8300f09f67c9 (patch) | |
tree | 02604b408a493beb90ebe6e246e691e64ed0d460 | |
parent | 36d4243cd5d75ae94923b29c1a4a79f8f941be7a (diff) | |
download | ydb-e39c1fe3cca27babe95bf01b7ace8300f09f67c9.tar.gz |
Fix incorrect requestSize via using multiput (#17208)
4 files changed, 80 insertions, 20 deletions
diff --git a/ydb/core/blobstorage/ut_blobstorage/lib/env.h b/ydb/core/blobstorage/ut_blobstorage/lib/env.h index 87b89da68f6..58aed6c5147 100644 --- a/ydb/core/blobstorage/ut_blobstorage/lib/env.h +++ b/ydb/core/blobstorage/ut_blobstorage/lib/env.h @@ -1000,8 +1000,9 @@ struct TEnvironmentSetup { return SyncQueryFactory<TResult>(actorId, [&] { return std::make_unique<TQuery>(args...); }); } - ui64 AggregateVDiskCounters(TString storagePool, ui32 nodesCount, ui32 groupSize, ui32 groupId, - const std::vector<ui32>& pdiskLayout, TString subsystem, TString counter, bool derivative = false) { + ui64 AggregateVDiskCountersBase(TString storagePool, ui32 nodesCount, ui32 groupSize, ui32 groupId, + const std::vector<ui32>& pdiskLayout, TString subsgroupName, TString subgroupValue, + TString counter, bool derivative = false) { ui64 ctr = 0; for (ui32 nodeId = 1; nodeId <= nodesCount; ++nodeId) { @@ -1019,12 +1020,24 @@ struct TEnvironmentSetup { GetSubgroup("orderNumber", orderNumber)-> GetSubgroup("pdisk", pdisk)-> GetSubgroup("media", "rot")-> - GetSubgroup("subsystem", subsystem)-> + GetSubgroup(subsgroupName, subgroupValue)-> GetCounter(counter, derivative)->Val(); } } return ctr; - }; + } + + ui64 AggregateVDiskCounters(TString storagePool, ui32 nodesCount, ui32 groupSize, ui32 groupId, + const std::vector<ui32>& pdiskLayout, TString subsystem, TString counter, bool derivative = false) { + return AggregateVDiskCountersBase(storagePool, nodesCount, groupSize, groupId, pdiskLayout, + "subsystem", subsystem, counter, derivative); + } + + ui64 AggregateVDiskCountersWithHandleClass(TString storagePool, ui32 nodesCount, ui32 groupSize, ui32 groupId, + const std::vector<ui32>& pdiskLayout, TString handleclass, TString counter) { + return AggregateVDiskCountersBase(storagePool, nodesCount, groupSize, groupId, pdiskLayout, + "handleclass", handleclass, counter); + } void SetIcbControl(ui32 nodeId, TString controlName, ui64 value) { if (nodeId == 0) { diff --git a/ydb/core/blobstorage/ut_blobstorage/monitoring.cpp b/ydb/core/blobstorage/ut_blobstorage/monitoring.cpp index 0a4b844e8e3..a1ed53615fc 100644 --- a/ydb/core/blobstorage/ut_blobstorage/monitoring.cpp +++ b/ydb/core/blobstorage/ut_blobstorage/monitoring.cpp @@ -106,19 +106,10 @@ void TestDSProxyAndVDiskEqualCost(const TBlobStorageGroupInfo::TTopology& topolo if (dsproxyCost == vdiskCost) { return; } + UNIT_ASSERT(queuePut != 0); UNIT_ASSERT_C(oks != actor->RequestsSent || queuePut != queueSent, str.Str()); } -#define MAKE_TEST(erasure, requestType, requests, inflight) \ -Y_UNIT_TEST(Test##requestType##erasure##Requests##requests##Inflight##inflight) { \ - auto groupType = TBlobStorageGroupType::Erasure##erasure; \ - ui32 realms = (groupType == TBlobStorageGroupType::ErasureMirror3dc) ? 3 : 1; \ - ui32 domains = (groupType == TBlobStorageGroupType::ErasureMirror3dc) ? 3 : 8; \ - TBlobStorageGroupInfo::TTopology topology(groupType, realms, domains, 1, true); \ - auto actor = new TInflightActor##requestType({requests, inflight}); \ - TestDSProxyAndVDiskEqualCost(topology, actor); \ -} - #define MAKE_TEST_W_DATASIZE(erasure, requestType, requests, inflight, dataSize) \ Y_UNIT_TEST(Test##requestType##erasure##Requests##requests##Inflight##inflight##BlobSize##dataSize) { \ auto groupType = TBlobStorageGroupType::Erasure##erasure; \ @@ -283,4 +274,54 @@ Y_UNIT_TEST_SUITE(DiskTimeAvailable) { } } +template <typename TInflightActor> +void TestDSProxyAndVDiskEqualByteCounters(TInflightActor* actor) { + std::unique_ptr<TEnvironmentSetup> env; + ui32 groupSize; + TBlobStorageGroupType groupType; + ui32 groupId; + std::vector<ui32> pdiskLayout; + TBlobStorageGroupInfo::TTopology topology(TBlobStorageGroupType::ErasureMirror3dc, 3, 3, 1, true); + SetupEnv(topology, env, groupSize, groupType, groupId, pdiskLayout); + actor->SetGroupId(TGroupId::FromValue(groupId)); + env->Runtime->Register(actor, 1); + env->Sim(TDuration::Minutes(10)); + ui64 dsproxyCounter = 0; + ui64 vdiskCounter = 0; + + for (ui32 nodeId = 1; nodeId <= groupSize; ++nodeId) { + auto* appData = env->Runtime->GetNode(nodeId)->AppData.get(); + for(auto sizeClass : {"256", "4096", "262144", "1048576", "16777216", "4194304"}) + dsproxyCounter += GetServiceCounters(appData->Counters, "dsproxynode")-> + GetSubgroup("subsystem", "request")-> + GetSubgroup("storagePool", env->StoragePoolName)-> + GetSubgroup("handleClass", "PutTabletLog")-> + GetSubgroup("sizeClass", sizeClass)-> + GetCounter("generatedSubrequestBytes")->Val(); + } + vdiskCounter = env->AggregateVDiskCountersWithHandleClass(env->StoragePoolName, groupSize, groupSize, groupId, pdiskLayout, + "PutTabletLog", "requestBytes"); + if constexpr(VERBOSE) { + for (ui32 i = 1; i <= groupSize; ++i) { + Cerr << " ##################### Node " << i << " ##################### " << Endl; + env->Runtime->GetNode(i)->AppData->Counters->OutputPlainText(Cerr); + } + } + UNIT_ASSERT(dsproxyCounter != 0); + UNIT_ASSERT_VALUES_EQUAL(dsproxyCounter, vdiskCounter); +} + + +Y_UNIT_TEST_SUITE(TestDSProxyAndVDiskEqualByteCounters) { + Y_UNIT_TEST(MultiPut) { + auto actor = new TInflightActorPut({10, 10}, 1000, 10); + TestDSProxyAndVDiskEqualByteCounters(actor); + } + + Y_UNIT_TEST(SinglePut) { + auto actor = new TInflightActorPut({1, 1}, 1000); + TestDSProxyAndVDiskEqualByteCounters(actor); + } +} + #undef MAKE_BURST_TEST diff --git a/ydb/core/blobstorage/ut_blobstorage/ut_helpers.h b/ydb/core/blobstorage/ut_blobstorage/ut_helpers.h index 4e02f66b26c..b93c702c0ad 100644 --- a/ydb/core/blobstorage/ut_blobstorage/ut_helpers.h +++ b/ydb/core/blobstorage/ut_blobstorage/ut_helpers.h @@ -96,9 +96,10 @@ protected: class TInflightActorPut : public TInflightActor { public: - TInflightActorPut(TSettings settings, ui32 dataSize = 1024) + TInflightActorPut(TSettings settings, ui32 dataSize = 1024, ui32 putsInBatch = 1) : TInflightActor(settings) , DataSize(dataSize) + , PutsInBatch(putsInBatch) {} STRICT_STFUNC(StateWork, @@ -116,10 +117,12 @@ public: protected: void SendRequest() override { - TString data = MakeData(DataSize); - auto ev = new TEvBlobStorage::TEvPut(TLogoBlobID(1, 1, 1, 10, DataSize, Cookie++), - data, TInstant::Max(), NKikimrBlobStorage::UserData); - SendToBSProxy(SelfId(), GroupId, ev, 0); + for (ui32 i = 0; i < PutsInBatch; ++i) { + TString data = MakeData(DataSize); + auto ev = new TEvBlobStorage::TEvPut(TLogoBlobID(1, 1, 1, 10, DataSize, Cookie++), + data, TInstant::Max(), NKikimrBlobStorage::TabletLog); + SendToBSProxy(SelfId(), GroupId, ev, 0); + } } void Handle(TEvBlobStorage::TEvPutResult::TPtr res) { @@ -129,6 +132,7 @@ protected: private: std::string Data; ui32 DataSize; + ui32 PutsInBatch; }; /////////////////////////////////// TInflightActorGet /////////////////////////////////// diff --git a/ydb/core/blobstorage/vdisk/skeleton/skeleton_vmultiput_actor.cpp b/ydb/core/blobstorage/vdisk/skeleton/skeleton_vmultiput_actor.cpp index 4b8c4e95148..edd240f52d3 100644 --- a/ydb/core/blobstorage/vdisk/skeleton/skeleton_vmultiput_actor.cpp +++ b/ydb/core/blobstorage/vdisk/skeleton/skeleton_vmultiput_actor.cpp @@ -82,10 +82,12 @@ namespace NKikimr { } TInstant now = TAppData::TimeProvider->Now(); + auto handleClass = Event->Get()->Record.GetHandleClass(); + const NVDiskMon::TLtcHistoPtr &histoPtr = VCtx->Histograms.GetHistogram(handleClass); const ui64 bufferSizeBytes = Event->Get()->GetBufferBytes(); auto vMultiPutResult = std::make_unique<TEvBlobStorage::TEvVMultiPutResult>(NKikimrProto::OK, vdisk, cookie, now, Event->Get()->GetCachedByteSize(), &vMultiPutRecord, SkeletonFrontIDPtr, MultiPutResMsgsPtr, - nullptr, bufferSizeBytes, IncarnationGuid, TString()); + histoPtr, bufferSizeBytes, IncarnationGuid, TString()); for (ui64 idx = 0; idx < Items.size(); ++idx) { TItem &result = Items[idx]; |