aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/zenstore/gc.cpp8
2 files changed, 9 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1110d3344..9e39c17aa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,7 @@
- Improvement: `zen oplog-import` command now does cloud storage host and Zenserver cache discovery
- `--builds-override-host` option can be used instead of or in addtition to `--builds` to specify host to override cloud storage host discovery
- `--zen-cache-host` specifies a Zenserver cache host that overrides any host discovery
+- Improvement: If gc disk usage log file is corrupt, remove and restart the log
- Bugfix: Add quotes around messages when using `--log-progress` with `zen builds` commands
- Bugfix: Fix ASSERT after running `zen workspace info` on a non-existing workspace. UE-349934
- Bugfix: Fixed issue where GC could start after shutdown of GC had been requested causing a race
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) {