diff options
Diffstat (limited to 'src/zenstore/cache/cachedisklayer.cpp')
| -rw-r--r-- | src/zenstore/cache/cachedisklayer.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/zenstore/cache/cachedisklayer.cpp b/src/zenstore/cache/cachedisklayer.cpp index a4aa497c4..3fc4eca03 100644 --- a/src/zenstore/cache/cachedisklayer.cpp +++ b/src/zenstore/cache/cachedisklayer.cpp @@ -1136,8 +1136,8 @@ ZenCacheDiskLayer::CacheBucket::InitializeIndexFromDisk(RwLock::ExclusiveLockSco } else { - const BlockStoreLocation& BlockLocation = Location.GetBlockLocation(m_Configuration.PayloadAlignment); - KnownBlocks.Add(BlockLocation.BlockIndex); + uint32_t BlockIndex = Location.Location.BlockLocation.GetBlockIndex(); + KnownBlocks.insert(BlockIndex); } } m_BlockStore.SyncExistingBlocksOnDisk(KnownBlocks); @@ -3649,6 +3649,7 @@ ZenCacheDiskLayer::CacheBucket::GetReferences(GcCtx& Ctx, bool StateIsAlreadyLoc { continue; } + const IoHash& Key = Entry.first; if (Loc.IsFlagSet(DiskLocation::kStandaloneFile)) { @@ -3672,7 +3673,10 @@ ZenCacheDiskLayer::CacheBucket::GetReferences(GcCtx& Ctx, bool StateIsAlreadyLoc } } - for (std::vector<std::size_t> ChunkIndexes : InlineBlockChunkIndexes) + OutReferences.reserve(OutReferences.size() + InlineKeys.size() + + StandaloneKeys.size()); // Make space for at least one attachment per record + + for (const std::vector<std::size_t>& ChunkIndexes : InlineBlockChunkIndexes) { ZEN_ASSERT(!ChunkIndexes.empty()); @@ -3694,12 +3698,15 @@ ZenCacheDiskLayer::CacheBucket::GetReferences(GcCtx& Ctx, bool StateIsAlreadyLoc auto CaptureAttachments = [&](size_t ChunkIndex, MemoryView Data) { if (GetAttachments(Data)) { - size_t AttachmentCount = OutReferences.size() - NextPrecachedReferencesStart; - if (WriteMetaData && AttachmentCount > 0) + if (WriteMetaData) { - Keys.push_back(InlineKeys[ChunkIndex]); - AttachmentCounts.push_back(gsl::narrow<uint32_t>(AttachmentCount)); - NextPrecachedReferencesStart += AttachmentCount; + size_t AttachmentCount = OutReferences.size() - NextPrecachedReferencesStart; + if (AttachmentCount > 0) + { + Keys.push_back(InlineKeys[ChunkIndex]); + AttachmentCounts.push_back(gsl::narrow<uint32_t>(AttachmentCount)); + NextPrecachedReferencesStart += AttachmentCount; + } } } }; |