From b784282c11da2da8eb9002ef320496bbffecaf1a Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Thu, 11 May 2023 09:03:45 +0200 Subject: if a block is missing during gc, log an error but still continue (#289) --- src/zenstore/blockstore.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/zenstore/blockstore.cpp b/src/zenstore/blockstore.cpp index 378d9fd52..0593ff06b 100644 --- a/src/zenstore/blockstore.cpp +++ b/src/zenstore/blockstore.cpp @@ -481,10 +481,14 @@ BlockStore::ReclaimSpace(const ReclaimSnapshotState& Snapshot, if (!OldBlockFile) { // If the block file pointed to does not exist, move them all to deleted list - BlockDeleteChunks[ChunkMapIndex].insert(BlockDeleteChunks[ChunkMapIndex].end(), - BlockKeepChunks[ChunkMapIndex].begin(), - BlockKeepChunks[ChunkMapIndex].end()); - BlockKeepChunks[ChunkMapIndex].clear(); + ChunkIndexArray& KeepMap = BlockKeepChunks[ChunkMapIndex]; + ZEN_ERROR("Expected to find block {} in {} - this should never happen, marking {} entries as deleted.", + BlockIndex, + m_BlocksBasePath, + KeepMap.size()); + + BlockDeleteChunks[ChunkMapIndex].insert(BlockDeleteChunks[ChunkMapIndex].end(), KeepMap.begin(), KeepMap.end()); + KeepMap.clear(); } const ChunkIndexArray& KeepMap = BlockKeepChunks[ChunkMapIndex]; -- cgit v1.2.3