From b9ea04109edefd1b2ed084d7c0edcf2dcd61d101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Mon, 14 Mar 2022 14:02:03 +0100 Subject: [PATCH] add explicit autocheckpoint, change db option traces! to debugs! --- src/database/mod.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/database/mod.rs b/src/database/mod.rs index f2c79d9..8e75be5 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -43,16 +43,16 @@ pub struct ConnectionOptions { impl ConnectionOptions { pub fn apply(&self, conn: &SqliteConnection) -> QueryResult<()> { if self.enable_foreign_keys { - trace!("Enabling foreign keys"); + debug!("Enabling foreign keys"); conn.execute("PRAGMA foreign_keys = ON;")?; } if let Some(duration) = self.busy_timeout { - trace!("Setting busy_timeout to {:?}", duration); + debug!("Setting busy_timeout to {:?}", duration); conn.execute(&format!("PRAGMA busy_timeout = {};", duration.as_millis()))?; } - trace!("Setting \"synchronous\" to NORMAL"); + debug!("Setting \"synchronous\" to NORMAL"); conn.execute("PRAGMA synchronous = NORMAL;")?; Ok(()) @@ -94,7 +94,7 @@ impl UpEndDatabase { let upend_path = db_path.unwrap_or_else(|| dirpath.as_ref().join(UPEND_SUBDIR)); if reinitialize { - trace!("Reinitializing - removing previous database..."); + debug!("Reinitializing - removing previous database..."); let _ = fs::remove_dir_all(&upend_path); } let new = !upend_path.exists(); @@ -133,10 +133,10 @@ impl UpEndDatabase { trace!("Running initial config."); let enable_wal_mode = true; connection.execute(if enable_wal_mode { - trace!("Enabling WAL journal mode & truncating WAL log..."); - "PRAGMA journal_mode = WAL;PRAGMA wal_checkpoint(TRUNCATE);" + debug!("Enabling WAL journal mode & truncating WAL log..."); + "PRAGMA journal_mode = WAL; PRAGMA wal_autocheckpoint = 1000; PRAGMA wal_checkpoint(TRUNCATE);" } else { - trace!("Enabling TRUNCATE journal mode"); + debug!("Enabling TRUNCATE journal mode"); "PRAGMA journal_mode = TRUNCATE;" })?;