From 9b6d181be460f9eb111fc2c162641138334e45e6 Mon Sep 17 00:00:00 2001 From: Pere Diaz Bou Date: Fri, 12 Sep 2025 13:49:14 +0000 Subject: [PATCH] wal: add hacky update max frame for mvcc use When multiple tx writes happen concurrently in mvcc, max frame will be updated. This new max_frame makes is the point of view of the other transaction return busy because his current wal snapshot is outdated. --- core/storage/wal.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/storage/wal.rs b/core/storage/wal.rs index 28e55bfbd..dff796790 100644 --- a/core/storage/wal.rs +++ b/core/storage/wal.rs @@ -306,6 +306,11 @@ pub trait Wal: Debug { fn set_io_context(&mut self, ctx: IOContext); + /// Update the max frame to the current shared max frame. + /// Currently this is only used for MVCC as it takes care of write conflicts on its own. + /// This should't be used with regular WAL mode. + fn update_max_frame(&mut self); + #[cfg(debug_assertions)] fn as_any(&self) -> &dyn std::any::Any; } @@ -1596,6 +1601,11 @@ impl Wal for WalFile { fn set_io_context(&mut self, ctx: IOContext) { self.io_ctx.replace(ctx); } + + fn update_max_frame(&mut self) { + let new_max_frame = self.get_shared().max_frame.load(Ordering::Acquire); + self.max_frame = new_max_frame; + } } impl WalFile {