aboutsummaryrefslogtreecommitdiff
path: root/zenserver/cache/structuredcachestore.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 /zenserver/cache/structuredcachestore.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 'zenserver/cache/structuredcachestore.cpp')
-rw-r--r--zenserver/cache/structuredcachestore.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp
index e22b06572..738e4c1fd 100644
--- a/zenserver/cache/structuredcachestore.cpp
+++ b/zenserver/cache/structuredcachestore.cpp
@@ -487,22 +487,24 @@ ZenCacheDiskLayer::CacheBucket::OpenLog(const fs::path& BucketDir, const bool Is
m_SobsFile.Open(SobsPath, IsNew ? BasicFile::Mode::kTruncate : BasicFile::Mode::kWrite);
m_SlogFile.Open(SlogPath, IsNew ? CasLogFile::Mode::kTruncate : CasLogFile::Mode::kWrite);
- m_SlogFile.Replay([&](const DiskIndexEntry& Entry) {
- if (Entry.Key == IoHash::Zero)
- {
- ++InvalidEntryCount;
- }
- else if (Entry.Location.IsFlagSet(DiskLocation::kTombStone))
- {
- m_TotalSize.fetch_sub(Entry.Location.Size(), std::memory_order::relaxed);
- }
- else
- {
- m_Index.insert_or_assign(Entry.Key, IndexEntry(Entry.Location, GcClock::TickCount()));
- m_TotalSize.fetch_add(Entry.Location.Size(), std::memory_order::relaxed);
- }
- MaxFileOffset = std::max<uint64_t>(MaxFileOffset, Entry.Location.Offset() + Entry.Location.Size());
- });
+ m_SlogFile.Replay(
+ [&](const DiskIndexEntry& Entry) {
+ if (Entry.Key == IoHash::Zero)
+ {
+ ++InvalidEntryCount;
+ }
+ else if (Entry.Location.IsFlagSet(DiskLocation::kTombStone))
+ {
+ m_TotalSize.fetch_sub(Entry.Location.Size(), std::memory_order::relaxed);
+ }
+ else
+ {
+ m_Index.insert_or_assign(Entry.Key, IndexEntry(Entry.Location, GcClock::TickCount()));
+ m_TotalSize.fetch_add(Entry.Location.Size(), std::memory_order::relaxed);
+ }
+ MaxFileOffset = std::max<uint64_t>(MaxFileOffset, Entry.Location.Offset() + Entry.Location.Size());
+ },
+ 0);
if (InvalidEntryCount)
{