aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-10-24 13:22:09 +0200
committerGitHub Enterprise <[email protected]>2025-10-24 13:22:09 +0200
commitc927c3806b4f103d6d3b9d3752821ba76b8e48f5 (patch)
treeafc82dab901cf442acc1797a3125afc7f8be784f /src
parentrefactor CasContainerStrategy::IterateOneBlock to make it more readable (#607) (diff)
downloadzen-c927c3806b4f103d6d3b9d3752821ba76b8e48f5.tar.xz
zen-c927c3806b4f103d6d3b9d3752821ba76b8e48f5.zip
gracefully handle broken gc dlog (#606)
* if gc.dlog is corrupt, remove and restart a new log
Diffstat (limited to 'src')
-rw-r--r--src/zenstore/gc.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/zenstore/gc.cpp b/src/zenstore/gc.cpp
index 8c3d802c3..b17103e43 100644
--- a/src/zenstore/gc.cpp
+++ b/src/zenstore/gc.cpp
@@ -1781,8 +1781,16 @@ GcScheduler::Initialize(const GcSchedulerConfig& Config)
m_AttachmentPassIndex = SchedulerState["AttachmentPassIndex"sv].AsUInt8();
}
+ const std::filesystem::path GcDiskUsageLogPath = m_Config.RootDirectory / "gc.dlog";
+ if (!TCasLogFile<DiskUsageWindow::DiskUsageEntry>::IsValid(GcDiskUsageLogPath))
+ {
+ ZEN_WARN("GC disk usage log at '{}' is malformed, restarting log", GcDiskUsageLogPath);
+ RemoveFile(GcDiskUsageLogPath);
+ }
+
m_DiskUsageLog.Open(m_Config.RootDirectory / "gc.dlog", CasLogFile::Mode::kWrite);
m_DiskUsageLog.Initialize();
+
const GcClock::Tick LastGCTick = m_LastGcTime.time_since_epoch().count();
m_DiskUsageLog.Replay(
[this, LastGCTick](const DiskUsageWindow::DiskUsageEntry& Entry) {