From 20b2f7109cd594493a0cb832855afb12a4fc6fd2 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Thu, 15 Aug 2024 16:24:35 +0200 Subject: prevent new block in gc (#118) * make sure we don't reset write-pos for new block for each block iterated --- CHANGELOG.md | 1 + src/zenstore/blockstore.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43acb0abc..90d8341c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Bugfix: Report back error to http caller if removal of oplog fails - Bugfix: If a cache bucket value fails validation - don't try to memcache the empty buffer - Bugfix: Skip chunk in block stores when iterating a block if the location is out of range +- Bugfix: Make sure we use the full max block size when compacting block store and not create a new block for each input block - Improvement: `xmake run zenserver ...` now passes in `--detach=false` to allow subprocesses to be terminated using Ctrl-C (previously, zenserver instances would linger) - Improvement: `zen workspace-share create` now resolves relative root paths to absolute paths - Improvement: Add better output/logging when failing to initialize shared mutex diff --git a/src/zenstore/blockstore.cpp b/src/zenstore/blockstore.cpp index 09f55af0e..70ddcedaf 100644 --- a/src/zenstore/blockstore.cpp +++ b/src/zenstore/blockstore.cpp @@ -1263,6 +1263,7 @@ BlockStore::CompactBlocks(const BlockStoreCompactState& CompactState, uint64_t RemovedSize = 0; Ref NewBlockFile; + uint64_t WriteOffset = m_MaxBlockSize + 1u; // Force detect a new block std::unique_ptr TargetFileBuffer; auto NewBlockFileGuard = MakeGuard([&]() { TargetFileBuffer.reset(); @@ -1352,7 +1353,6 @@ BlockStore::CompactBlocks(const BlockStoreCompactState& CompactState, }); BasicFileBuffer SourceFileBuffer(OldBlockFile->GetBasicFile(), Min(65536u, OldBlockSize)); - uint64_t WriteOffset = m_MaxBlockSize + 1u; // Force detect a new block uint64_t WrittenBytesToBlock = 0; uint64_t MovedFromBlock = 0; std::vector Chunk; -- cgit v1.2.3