From 605b4f330eed43b14135f37ffb58c14fa1cd79c2 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Mon, 4 Apr 2022 12:05:25 +0200 Subject: always keep full log but read from index snapshot location if available --- zenstore/cidstore.cpp | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'zenstore/cidstore.cpp') diff --git a/zenstore/cidstore.cpp b/zenstore/cidstore.cpp index 482a89b9d..509d21abe 100644 --- a/zenstore/cidstore.cpp +++ b/zenstore/cidstore.cpp @@ -134,28 +134,30 @@ struct CidStore::Impl uint64_t TombstoneCount = 0; uint64_t InvalidCount = 0; - m_LogFile.Replay([&](const IndexEntry& Entry) { - if (Entry.Compressed != IoHash::Zero) - { - // Update - m_CidMap.insert_or_assign(Entry.Uncompressed, Entry.Compressed); - } - else - { - if (Entry.Uncompressed != IoHash::Zero) + m_LogFile.Replay( + [&](const IndexEntry& Entry) { + if (Entry.Compressed != IoHash::Zero) { - // Tombstone - m_CidMap.erase(Entry.Uncompressed); - ++TombstoneCount; + // Update + m_CidMap.insert_or_assign(Entry.Uncompressed, Entry.Compressed); } else { - // Completely uninitialized entry with both hashes set to zero indicates a - // problem. Might be an unwritten page due to BSOD or some other problem - ++InvalidCount; + if (Entry.Uncompressed != IoHash::Zero) + { + // Tombstone + m_CidMap.erase(Entry.Uncompressed); + ++TombstoneCount; + } + else + { + // Completely uninitialized entry with both hashes set to zero indicates a + // problem. Might be an unwritten page due to BSOD or some other problem + ++InvalidCount; + } } - } - }); + }, + 0); ZEN_INFO("CID index initialized: {} entries found ({} tombstones, {} invalid)", m_CidMap.size(), TombstoneCount, InvalidCount); } -- cgit v1.2.3