add explicit autocheckpoint, change db option traces! to debugs!

feat/vaults
Tomáš Mládek 2022-03-14 14:02:03 +01:00
parent 89332de506
commit b9ea04109e
No known key found for this signature in database
GPG Key ID: 65E225C8B3E2ED8A
1 changed files with 7 additions and 7 deletions

View File

@ -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;"
})?;