mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-23 17:05:36 +01:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user