diff options
| author | Dan Engelbrecht <[email protected]> | 2024-12-17 14:20:48 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-12-17 14:20:48 +0100 |
| commit | 48657d2fb6c9c709ec29264a609350c7b4a541f9 (patch) | |
| tree | a2c1997a99e9659ee038663e1a8da4b56ec01ad5 /src/zenstore/blockstore.cpp | |
| parent | remove all referenced attachments in op from pending chunk references (#267) (diff) | |
| download | zen-48657d2fb6c9c709ec29264a609350c7b4a541f9.tar.xz zen-48657d2fb6c9c709ec29264a609350c7b4a541f9.zip | |
batch fetch record cache values (#266)
- Improvement: Batch fetch record attachments when appropriate
- Improvement: Reduce memory buffer allocation in BlockStore::IterateBlock
- Improvement: Tweaked BlockStore::IterateBlock logic when to use threaded work (at least 4 chunks requested)
- Bugfix: CasContainerStrategy::IterateChunks could give wrong payload/index when requesting 1 or 2 chunks
Diffstat (limited to 'src/zenstore/blockstore.cpp')
| -rw-r--r-- | src/zenstore/blockstore.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/zenstore/blockstore.cpp b/src/zenstore/blockstore.cpp index 9ad672060..3974fb989 100644 --- a/src/zenstore/blockstore.cpp +++ b/src/zenstore/blockstore.cpp @@ -809,8 +809,8 @@ BlockStore::IterateBlock(std::span<const BlockStoreLocation> ChunkLocations, ZEN_ASSERT(BlockFile); InsertLock.ReleaseNow(); - IoBuffer ReadBuffer{IterateSmallChunkWindowSize}; - void* BufferBase = ReadBuffer.MutableData(); + IoBuffer ReadBuffer; + void* BufferBase = nullptr; size_t LocationIndexOffset = 0; while (LocationIndexOffset < ChunkIndexes.size()) @@ -825,6 +825,11 @@ BlockStore::IterateBlock(std::span<const BlockStoreLocation> ChunkLocations, size_t LastChunkIndex = ChunkIndexes[LocationIndexOffset + RangeCount - 1]; const BlockStoreLocation& LastLocation = ChunkLocations[LastChunkIndex]; uint64_t Size = LastLocation.Offset + LastLocation.Size - FirstLocation.Offset; + if (ReadBuffer.GetSize() < Size) + { + ReadBuffer = IoBuffer(Min(Size * 2, IterateSmallChunkWindowSize)); + BufferBase = ReadBuffer.MutableData(); + } BlockFile->Read(BufferBase, Size, FirstLocation.Offset); for (size_t RangeIndex = 0; RangeIndex < RangeCount; ++RangeIndex) { |