add explicit autocheckpoint, change db option traces! to debugs!
parent
89332de506
commit
b9ea04109e
|
@ -43,16 +43,16 @@ pub struct ConnectionOptions {
|
||||||
impl ConnectionOptions {
|
impl ConnectionOptions {
|
||||||
pub fn apply(&self, conn: &SqliteConnection) -> QueryResult<()> {
|
pub fn apply(&self, conn: &SqliteConnection) -> QueryResult<()> {
|
||||||
if self.enable_foreign_keys {
|
if self.enable_foreign_keys {
|
||||||
trace!("Enabling foreign keys");
|
debug!("Enabling foreign keys");
|
||||||
conn.execute("PRAGMA foreign_keys = ON;")?;
|
conn.execute("PRAGMA foreign_keys = ON;")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(duration) = self.busy_timeout {
|
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()))?;
|
conn.execute(&format!("PRAGMA busy_timeout = {};", duration.as_millis()))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
trace!("Setting \"synchronous\" to NORMAL");
|
debug!("Setting \"synchronous\" to NORMAL");
|
||||||
conn.execute("PRAGMA synchronous = NORMAL;")?;
|
conn.execute("PRAGMA synchronous = NORMAL;")?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -94,7 +94,7 @@ impl UpEndDatabase {
|
||||||
let upend_path = db_path.unwrap_or_else(|| dirpath.as_ref().join(UPEND_SUBDIR));
|
let upend_path = db_path.unwrap_or_else(|| dirpath.as_ref().join(UPEND_SUBDIR));
|
||||||
|
|
||||||
if reinitialize {
|
if reinitialize {
|
||||||
trace!("Reinitializing - removing previous database...");
|
debug!("Reinitializing - removing previous database...");
|
||||||
let _ = fs::remove_dir_all(&upend_path);
|
let _ = fs::remove_dir_all(&upend_path);
|
||||||
}
|
}
|
||||||
let new = !upend_path.exists();
|
let new = !upend_path.exists();
|
||||||
|
@ -133,10 +133,10 @@ impl UpEndDatabase {
|
||||||
trace!("Running initial config.");
|
trace!("Running initial config.");
|
||||||
let enable_wal_mode = true;
|
let enable_wal_mode = true;
|
||||||
connection.execute(if enable_wal_mode {
|
connection.execute(if enable_wal_mode {
|
||||||
trace!("Enabling WAL journal mode & truncating WAL log...");
|
debug!("Enabling WAL journal mode & truncating WAL log...");
|
||||||
"PRAGMA journal_mode = WAL;PRAGMA wal_checkpoint(TRUNCATE);"
|
"PRAGMA journal_mode = WAL; PRAGMA wal_autocheckpoint = 1000; PRAGMA wal_checkpoint(TRUNCATE);"
|
||||||
} else {
|
} else {
|
||||||
trace!("Enabling TRUNCATE journal mode");
|
debug!("Enabling TRUNCATE journal mode");
|
||||||
"PRAGMA journal_mode = TRUNCATE;"
|
"PRAGMA journal_mode = TRUNCATE;"
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue