diff options
| author | Dan Engelbrecht <[email protected]> | 2022-05-09 13:51:52 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-05-09 13:51:52 +0200 |
| commit | 8265ceec30d7a8cc862928507c6eed12191e5ef5 (patch) | |
| tree | de40771ed96d013992eb0c502317ea76940827fe /zenstore/compactcas.cpp | |
| parent | Initialize upstream apply in background thread (#88) (diff) | |
| parent | Make sure blockstore owner and block store state does not get out of sync whe... (diff) | |
| download | zen-1.0.1.3.tar.xz zen-1.0.1.3.zip | |
Merge pull request #91 from EpicGames/de/block-store-gc-bugv1.0.1.3
Make sure block store owner and block store state does not get out of sync when fetching a chunk
Diffstat (limited to 'zenstore/compactcas.cpp')
| -rw-r--r-- | zenstore/compactcas.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/zenstore/compactcas.cpp b/zenstore/compactcas.cpp index cc0e2241c..2d48265f7 100644 --- a/zenstore/compactcas.cpp +++ b/zenstore/compactcas.cpp @@ -258,8 +258,8 @@ CasContainerStrategy::InsertChunk(const void* ChunkData, size_t ChunkSize, const RwLock::ExclusiveLockScope _(m_LocationMapLock); m_LocationMap.emplace(ChunkHash, DiskLocation); } - m_TotalSize.fetch_add(static_cast<uint64_t>(ChunkSize), std::memory_order::relaxed); }); + m_TotalSize.fetch_add(static_cast<uint64_t>(ChunkSize), std::memory_order::relaxed); return CasStore::InsertResult{.New = true}; } @@ -279,16 +279,10 @@ CasContainerStrategy::FindChunk(const IoHash& ChunkHash) { return IoBuffer(); } - BlockStoreLocation Location = KeyIt->second.Get(m_PayloadAlignment); - _.ReleaseNow(); - - Ref<BlockStoreFile> ChunkBlock = m_BlockStore.GetChunkBlock(Location); - if (!ChunkBlock) - { - return IoBuffer(); - } + const BlockStoreLocation& Location = KeyIt->second.Get(m_PayloadAlignment); - return ChunkBlock->GetChunk(Location.Offset, Location.Size); + IoBuffer Chunk = m_BlockStore.TryGetChunk(Location); + return Chunk; } bool |