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.
This commit is contained in:
Pere Diaz Bou
2025-09-12 13:49:14 +00:00
parent 66b5630870
commit 9b6d181be4

View File

@@ -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 {