From 66956ef86729320bed14e8420749eb7e55e20faf Mon Sep 17 00:00:00 2001 From: zzstoatzz Date: Fri, 7 Aug 2026 21:53:18 -0500 Subject: [PATCH] compact: announce and progress-log the startup tombstone rebuild MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The rebuild runs before ingest dials (upstream ordering) and scales with the watermark backlog — hours on a large archive with a low watermark. It previously logged only on completion, making a long rebuild indistinguishable from a hang (the 2026-08-07 restart-pause diagnosis chase). Now: a start line with the loaded watermark and segment count, progress every 200 segments, and the live-entry gauge published as it grows. No semantic change. --- src/internal/compact/steady.zig | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/internal/compact/steady.zig b/src/internal/compact/steady.zig index 17358c1..3b68d48 100644 --- a/src/internal/compact/steady.zig +++ b/src/internal/compact/steady.zig @@ -100,6 +100,17 @@ pub const Compactor = struct { defer seg_dir.close(self.io); self.mu.lockUncancelable(self.io); defer self.mu.unlock(self.io); + // This scan runs before ingest dials (upstream ordering) and, with a + // low watermark on a large archive, takes hours. Announce the work up + // front and log progress so a long rebuild is a progress bar, never a + // silent hang (the 2026-08-07 "3.5h restart pause" diagnosis chase). + var total: u64 = 0; + var count_it = seg_dir.iterate(); + while (try count_it.next(self.io)) |entry| { + if (archive_mod.parseSegmentIndex(entry.name) != null) total += 1; + } + log.info("tombstone rebuild starting above watermark {d}: {d} segments to fold (ingest dials after this completes)", .{ w, total }); + var folded: u64 = 0; var it = seg_dir.iterate(); while (try it.next(self.io)) |entry| { const idx = archive_mod.parseSegmentIndex(entry.name) orelse continue; @@ -107,6 +118,11 @@ pub const Compactor = struct { error.ActiveSegment => continue, else => return err, }; + folded += 1; + if (folded % 200 == 0) { + log.info("tombstone rebuild {d}/{d}: {d} live entries", .{ folded, total, self.live.len() }); + if (self.stats) |s| s.compaction_tombstone_set_entries.store(self.live.len(), .monotonic); + } } if (self.stats) |s| s.compaction_watermark.store(w, .monotonic); self.publishTombstoneGauges(); -- 2.51.2