From 39dec647a7b4f6dade77d41dc88e38644804cbee Mon Sep 17 00:00:00 2001 From: Jussi Saurio Date: Thu, 31 Jul 2025 12:43:49 +0300 Subject: [PATCH] fix/wal: reset page cache when another connection checkpointed in between --- core/storage/wal.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/storage/wal.rs b/core/storage/wal.rs index 90e407cd9..f3b67f08b 100644 --- a/core/storage/wal.rs +++ b/core/storage/wal.rs @@ -776,7 +776,11 @@ impl Wal for WalFile { let checkpoint_seq = shared.wal_header.lock().checkpoint_seq; (mx, nb, ck, checkpoint_seq) }; - let db_changed = shared_max > self.max_frame; + // This needs to be an != comparison because either of the following can be true: + // - Another connection added more WAL frames -> shared max is bigger + // - Another connection checkpointed -> shared max is smaller + // TODO: are there cases where shared_max == self.max_frame but the DB has still changed in between?? + let db_changed = shared_max != self.max_frame; // WAL is already fully back‑filled into the main DB image // (mxFrame == nBackfill). Readers can therefore ignore the