diff options
-rw-r--r-- | ydb/core/blob_depot/agent/agent_impl.h | 2 | ||||
-rw-r--r-- | ydb/core/blob_depot/agent/blob_mapping_cache.cpp | 8 | ||||
-rw-r--r-- | ydb/core/blob_depot/agent/blob_mapping_cache.h | 1 |
3 files changed, 7 insertions, 4 deletions
diff --git a/ydb/core/blob_depot/agent/agent_impl.h b/ydb/core/blob_depot/agent/agent_impl.h index 21642cf8da..c49b7c9ffa 100644 --- a/ydb/core/blob_depot/agent/agent_impl.h +++ b/ydb/core/blob_depot/agent/agent_impl.h @@ -465,7 +465,7 @@ namespace NKikimr::NBlobDepot { // Blob mapping cache class TBlobMappingCache; - std::unique_ptr<TBlobMappingCache> BlobMappingCachePtr; + std::shared_ptr<TBlobMappingCache> BlobMappingCachePtr; TBlobMappingCache& BlobMappingCache; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/ydb/core/blob_depot/agent/blob_mapping_cache.cpp b/ydb/core/blob_depot/agent/blob_mapping_cache.cpp index 77800af63a..f3150047ba 100644 --- a/ydb/core/blob_depot/agent/blob_mapping_cache.cpp +++ b/ydb/core/blob_depot/agent/blob_mapping_cache.cpp @@ -116,9 +116,11 @@ namespace NKikimr::NBlobDepot { const ui64 id = Agent.NextOtherRequestId++; const bool inserted1 = entry.PendingQueries.emplace(id, mustRestoreFirst).second; Y_VERIFY(inserted1); - auto cancelCallback = [&entry, id] { - const size_t numErased = entry.PendingQueries.erase(id); - Y_VERIFY(numErased); + auto cancelCallback = [&entry, id, self = weak_from_this()] { + if (!self.expired()) { + const size_t numErased = entry.PendingQueries.erase(id); + Y_VERIFY(numErased); + } }; Agent.RegisterRequest(id, query, std::move(context), std::move(cancelCallback), false); diff --git a/ydb/core/blob_depot/agent/blob_mapping_cache.h b/ydb/core/blob_depot/agent/blob_mapping_cache.h index 57aaa3ff4c..45f16e7e9a 100644 --- a/ydb/core/blob_depot/agent/blob_mapping_cache.h +++ b/ydb/core/blob_depot/agent/blob_mapping_cache.h @@ -7,6 +7,7 @@ namespace NKikimr::NBlobDepot { class TBlobDepotAgent::TBlobMappingCache : public TRequestSender + , public std::enable_shared_from_this<TBlobMappingCache> { struct TCachedKeyItem : TIntrusiveListItem<TCachedKeyItem> { TStringBuf Key; // key buffer (view of key part of the Cache set) |