fix: add mutex around wal_checkpoint()

Documentation comment explains how it prevents the deadlock.
This commit is contained in:
link2xt
2026-03-06 04:34:24 +00:00
committed by l
parent 874e38c146
commit 53acfaa054
2 changed files with 20 additions and 0 deletions

View File

@@ -34,6 +34,7 @@ pub(crate) struct WalCheckpointStats {
/// Runs a checkpoint operation in TRUNCATE mode, so the WAL file is truncated to 0 bytes.
pub(super) async fn wal_checkpoint(pool: &Pool) -> Result<WalCheckpointStats> {
let _guard = pool.inner.wal_checkpoint_mutex.lock().await;
let t_start = Time::now();
// Do as much work as possible without blocking anybody.