aboutsummaryrefslogtreecommitdiff
path: root/zenstore/filecas.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2022-04-04 12:05:25 +0200
committerDan Engelbrecht <[email protected]>2022-04-04 12:05:25 +0200
commit605b4f330eed43b14135f37ffb58c14fa1cd79c2 (patch)
treee8c99f26abb0634ecf53afe76cebd6f0c05742ca /zenstore/filecas.cpp
parentlogging cleanup (diff)
downloadzen-605b4f330eed43b14135f37ffb58c14fa1cd79c2.tar.xz
zen-605b4f330eed43b14135f37ffb58c14fa1cd79c2.zip
always keep full log but read from index snapshot location if available
Diffstat (limited to 'zenstore/filecas.cpp')
-rw-r--r--zenstore/filecas.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/zenstore/filecas.cpp b/zenstore/filecas.cpp
index 6b0082ab0..b53cfaa54 100644
--- a/zenstore/filecas.cpp
+++ b/zenstore/filecas.cpp
@@ -98,26 +98,28 @@ FileCasStrategy::Initialize(bool IsNewStore)
std::unordered_set<IoHash> FoundEntries;
FoundEntries.reserve(10000);
- m_CasLog.Replay([&](const FileCasIndexEntry& Entry) {
- if (Entry.IsFlagSet(FileCasIndexEntry::kTombStone))
- {
- if (!FoundEntries.contains(Entry.Key))
+ m_CasLog.Replay(
+ [&](const FileCasIndexEntry& Entry) {
+ if (Entry.IsFlagSet(FileCasIndexEntry::kTombStone))
{
- return;
+ if (!FoundEntries.contains(Entry.Key))
+ {
+ return;
+ }
+ m_TotalSize.fetch_sub(Entry.Size, std::memory_order_relaxed);
+ FoundEntries.erase(Entry.Key);
}
- m_TotalSize.fetch_sub(Entry.Size, std::memory_order_relaxed);
- FoundEntries.erase(Entry.Key);
- }
- else
- {
- if (FoundEntries.contains(Entry.Key))
+ else
{
- return;
+ if (FoundEntries.contains(Entry.Key))
+ {
+ return;
+ }
+ FoundEntries.insert(Entry.Key);
+ m_TotalSize.fetch_add(Entry.Size, std::memory_order_relaxed);
}
- FoundEntries.insert(Entry.Key);
- m_TotalSize.fetch_add(Entry.Size, std::memory_order_relaxed);
- }
- });
+ },
+ 0);
}
CasStore::InsertResult