From f7465f665de751d66815da4b1a7f9a46d21ce9e3 Mon Sep 17 00:00:00 2001 From: Pere Diaz Bou Date: Tue, 8 Jul 2025 15:54:28 +0200 Subject: [PATCH] add checkpoint lock to wal --- core/storage/sqlite3_ondisk.rs | 1 + core/storage/wal.rs | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/core/storage/sqlite3_ondisk.rs b/core/storage/sqlite3_ondisk.rs index b07df89df..d9d330a0c 100644 --- a/core/storage/sqlite3_ondisk.rs +++ b/core/storage/sqlite3_ondisk.rs @@ -1331,6 +1331,7 @@ pub fn read_entire_wal_dumb(file: &Arc) -> Result { @@ -835,6 +840,7 @@ impl Wal for WalFile { return Ok(CheckpointStatus::IO); } let shared = self.get_shared(); + shared.checkpoint_lock.unlock(); // Record two num pages fields to return as checkpoint result to caller. // Ref: pnLog, pnCkpt on https://www.sqlite.org/c3ref/wal_checkpoint_v2.html @@ -1096,6 +1102,7 @@ impl WalFileShared { nreads: AtomicU32::new(0), value: AtomicU32::new(READMARK_NOT_USED), }, + checkpoint_lock: LimboRwLock::new(), loaded: AtomicBool::new(true), }; Ok(Arc::new(UnsafeCell::new(shared)))