aboutsummaryrefslogtreecommitdiff
path: root/src/db/open.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2024-03-18 20:17:54 +0100
committerAlex Auvolat <alex@adnab.me>2024-03-18 20:19:30 +0100
commit0038ca8a78f147b9c0ec07ef0121773aaf110dc9 (patch)
tree43f39f30c63a6affa62eeea62cfec674f217c2b4 /src/db/open.rs
parent81191d2d92e58ff82ace0f4d82b275c157673ade (diff)
parent1a0bffae3491fae6af5a8d4defc5c6b84839e197 (diff)
downloadgarage-0038ca8a78f147b9c0ec07ef0121773aaf110dc9.tar.gz
garage-0038ca8a78f147b9c0ec07ef0121773aaf110dc9.zip
Merge branch 'main' into next-0.10
Diffstat (limited to 'src/db/open.rs')
-rw-r--r--src/db/open.rs10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/db/open.rs b/src/db/open.rs
index 03476a42..19bc96cc 100644
--- a/src/db/open.rs
+++ b/src/db/open.rs
@@ -68,14 +68,8 @@ pub fn open_db(path: &PathBuf, engine: Engine, opt: &OpenOpt) -> Result<Db> {
#[cfg(feature = "sqlite")]
Engine::Sqlite => {
info!("Opening Sqlite database at: {}", path.display());
- let db = crate::sqlite_adapter::rusqlite::Connection::open(&path)?;
- db.pragma_update(None, "journal_mode", "WAL")?;
- if opt.fsync {
- db.pragma_update(None, "synchronous", "NORMAL")?;
- } else {
- db.pragma_update(None, "synchronous", "OFF")?;
- }
- Ok(crate::sqlite_adapter::SqliteDb::init(db))
+ let manager = r2d2_sqlite::SqliteConnectionManager::file(path);
+ Ok(crate::sqlite_adapter::SqliteDb::new(manager, opt.fsync)?)
}
// ---- LMDB DB ----