diff options
author | yuryalekseev <yuryalekseev@yandex-team.com> | 2022-10-19 14:44:39 +0300 |
---|---|---|
committer | yuryalekseev <yuryalekseev@yandex-team.com> | 2022-10-19 14:44:39 +0300 |
commit | efc600cce7c384e439add3dd40aadbaf818571be (patch) | |
tree | 5fb0ed2bca036440368c935eaee2b3893c6fdea6 | |
parent | 38a09010d855ece723ea61361aa27e6c92aea6c3 (diff) | |
download | ydb-efc600cce7c384e439add3dd40aadbaf818571be.tar.gz |
Some TBlockAndGetActor refinements.
3 files changed, 14 insertions, 8 deletions
diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_mongroups.h b/ydb/core/blobstorage/vdisk/common/vdisk_mongroups.h index 213e057dcce..118cc062cad 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_mongroups.h +++ b/ydb/core/blobstorage/vdisk/common/vdisk_mongroups.h @@ -431,6 +431,7 @@ public: COUNTER_INIT(GetMsgs, true); COUNTER_INIT(BlockMsgs, true); COUNTER_INIT(GetBlockMsgs, true); + COUNTER_INIT(BlockAndGetMsgs, true); COUNTER_INIT(GCMsgs, true); COUNTER_INIT(GetBarrierMsgs, true); COUNTER_INIT(SyncMsgs, true); @@ -473,6 +474,7 @@ public: COUNTER_DEF(GetMsgs); COUNTER_DEF(BlockMsgs); COUNTER_DEF(GetBlockMsgs); + COUNTER_DEF(BlockAndGetMsgs); COUNTER_DEF(GCMsgs); COUNTER_DEF(GetBarrierMsgs); COUNTER_DEF(SyncMsgs); diff --git a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp index 571519f7c68..afd133c51b0 100644 --- a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp +++ b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp @@ -890,12 +890,14 @@ namespace NKikimr { && Hull->IsBlocked(record.GetReaderTabletData().GetId(), {record.GetReaderTabletData().GetGeneration(), 0}).Status != TBlocksCache::EStatus::OK) { ReplyError(NKikimrProto::BLOCKED, "tablet's generation is blocked", ev, ctx, now); } else { - if (ev->Get()->Record.GetForceBlockTabletData().GetGeneration() > 0) { + if (ev->Get()->Record.HasForceBlockTabletData() && ev->Get()->Record.GetForceBlockTabletData().GetGeneration() > 0) { + IFaceMonGroup->BlockAndGetMsgs()++; + auto tabletId = ev->Get()->Record.GetForceBlockTabletData().GetId(); - auto tabletGeneration = ev->Get()->Record.GetForceBlockTabletData().GetGeneration(); - ui32 blockedGeneration = 0; - if (!Hull->GetBlocked(tabletId, &blockedGeneration) || blockedGeneration < tabletGeneration) { - // TODO: add counter + auto requiredTabletGeneration = ev->Get()->Record.GetForceBlockTabletData().GetGeneration(); + ui32 blockedTabletGeneration = 0; + if (!Hull->GetBlocked(tabletId, &blockedTabletGeneration) || blockedTabletGeneration < requiredTabletGeneration) { + // block vdisk and do a get from it auto actor = CreateBlockAndGetActor( std::move(ev), SelfId(), diff --git a/ydb/core/blobstorage/vdisk/skeleton/skeleton_block_and_get.cpp b/ydb/core/blobstorage/vdisk/skeleton/skeleton_block_and_get.cpp index c5ec8733337..e7b154b70f7 100644 --- a/ydb/core/blobstorage/vdisk/skeleton/skeleton_block_and_get.cpp +++ b/ydb/core/blobstorage/vdisk/skeleton/skeleton_block_and_get.cpp @@ -12,6 +12,8 @@ namespace NKikimr { class TBlockAndGetActor : public TActorBootstrapped<TBlockAndGetActor> { +private: + static constexpr auto VBLOCK_DEFAULT_DEADLINE_SECONDS = 120; public: TBlockAndGetActor() = delete; explicit TBlockAndGetActor( @@ -44,7 +46,7 @@ public: VDiskIDFromVDiskID(Request->Get()->Record.GetVDiskID()), Request->Get()->Record.GetMsgQoS().HasDeadlineSeconds() ? TInstant::Seconds(Request->Get()->Record.GetMsgQoS().GetDeadlineSeconds()) : - TInstant::Max() + TInstant::Seconds(VBLOCK_DEFAULT_DEADLINE_SECONDS) ); // send TEvVBlock request @@ -84,8 +86,8 @@ public: } // send TEvVGet request, the reply will go directly to sender. - // there is no need to clear ForceBlockTabletData parameter - // since by now the required generation has been blocked. + // clear ForceBlockTabletData to make sure we never ever have a cycle. + Request->Get()->Record.ClearForceBlockTabletData(); TActivationContext::Send(Request.Release()); PassAway(); } |