diff options
author | alexvru <alexvru@ydb.tech> | 2022-10-20 15:58:47 +0300 |
---|---|---|
committer | alexvru <alexvru@ydb.tech> | 2022-10-20 15:58:47 +0300 |
commit | 1c4fb2b2d7b2042d97a252f5d834afff058e99d7 (patch) | |
tree | 4207428052a60bdb97efa560325c65065d95b06f | |
parent | 97a272deeb0bcaf558aa68e0830bccc89bdf9ffc (diff) | |
download | ydb-1c4fb2b2d7b2042d97a252f5d834afff058e99d7.tar.gz |
Fix BlobDepot block bug
-rw-r--r-- | ydb/core/blob_depot/blocks.cpp | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/ydb/core/blob_depot/blocks.cpp b/ydb/core/blob_depot/blocks.cpp index cf0253a74b6..5b4b5a58263 100644 --- a/ydb/core/blob_depot/blocks.cpp +++ b/ydb/core/blob_depot/blocks.cpp @@ -80,7 +80,22 @@ namespace NKikimr::NBlobDepot { , Response(std::move(response)) {} + bool CheckIfObsolete() { + auto& block = Self->BlocksManager->Blocks[TabletId]; + if (block.BlockedGeneration == BlockedGeneration && block.IssuerGuid == IssuerGuid) { + return false; + } else { + auto& r = Response->Get<TEvBlobDepot::TEvBlockResult>()->Record; + r.SetStatus(NKikimrProto::ALREADY); + Finish(); + return true; + } + } + void Bootstrap() { + if (CheckIfObsolete()) { + return; + } IssueNotificationsToAgents(); Become(&TThis::StateFunc, AgentsWaitTime, new TEvents::TEvWakeup); } @@ -186,12 +201,17 @@ namespace NKikimr::NBlobDepot { PassAway(); } - STRICT_STFUNC(StateFunc, - hFunc(TEvBlobStorage::TEvBlockResult, Handle); - hFunc(TEvBlobDepot::TEvPushNotifyResult, Handle); - cFunc(TEvents::TSystem::Wakeup, IssueBlocksToStorage); - cFunc(TEvents::TSystem::Poison, PassAway); - ) + STATEFN(StateFunc) { + if (CheckIfObsolete()) { + return; + } + switch (ev->GetTypeRewrite()) { + hFunc(TEvBlobStorage::TEvBlockResult, Handle); + hFunc(TEvBlobDepot::TEvPushNotifyResult, Handle); + cFunc(TEvents::TSystem::Wakeup, IssueBlocksToStorage); + cFunc(TEvents::TSystem::Poison, PassAway); + } + } }; void TBlobDepot::TBlocksManager::AddBlockOnLoad(ui64 tabletId, ui32 blockedGeneration, ui64 issuerGuid) { |