fix(depot): teach doctor to diagnose reclaimed history via shard-seeded replay#5222
Conversation
|
Stack for rivet-dev/rivet
Get stack: |
Code ReviewOverviewThis PR teaches the depot doctor to correctly diagnose databases with reclaimed history. When the reclaimer prunes delta history at or below the hot watermark, the doctor previously saw the gaps as corruption. The fix seeds the sequential replay image from hot shard coverage at the watermark and only replays deltas above it, then threads Code QualityCorrectness
Minor concern — error message lacks context Line 1591: .context("hot watermark commit row is missing for sequential replay")?;If the watermark commit row is absent (e.g., a race where reclaim removes a keep-set row unexpectedly), the error gives no indication of which txid was expected. Consider: .with_context(|| format!("hot watermark commit row missing for txid {} in sequential replay", replay_floor_txid))?;Minor concern — O(pages × shard_pages) coverage check Lines 1627–1633 iterate No issue — separate transaction for watermark read
Test CoverageThe new
Suggestion — assert The test asserts the verdict is Conventions
SummaryThe approach is sound and edge cases are handled correctly: no shards when floor > 0 falls through to a zero-filled seed (correctly diagnosed as corrupted), sub-replays are clamped to above the floor, and contiguity analysis is bounded above the floor. The two items above are minor polish rather than blocking issues. |
No description provided.