Skip to content

Commit a494735

Browse files
authored
checkpoint metastore after every operation (tursodatabase#1393)
1 parent 80db147 commit a494735

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

libsql-server/src/namespace/meta_store.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,15 @@ fn try_process(
369369
)?;
370370
}
371371

372+
if let Err(e) = checkpoint(&inner.conn) {
373+
tracing::warn!("failed to checkpoint metastore: {e}");
374+
}
375+
376+
Ok(())
377+
}
378+
379+
fn checkpoint(conn: &rusqlite::Connection) -> Result<()> {
380+
conn.execute("PRAGMA wal_checkpoint(TRUNCATE)", ())?;
372381
Ok(())
373382
}
374383

0 commit comments

Comments
 (0)