diff options
author | Alex <alex@adnab.me> | 2024-03-18 19:02:36 +0000 |
---|---|---|
committer | Alex <alex@adnab.me> | 2024-03-18 19:02:36 +0000 |
commit | 1a0bffae3491fae6af5a8d4defc5c6b84839e197 (patch) | |
tree | fcf59c762f2fd904a8c0567e7466f10a536ae77b /src/db/open.rs | |
parent | fd2e19bf1bf301bc03aa29ffa3fe1e71008cbe50 (diff) | |
parent | b55f52a9b75359b02938ac003a6ea853b36a4f3e (diff) | |
download | garage-1a0bffae3491fae6af5a8d4defc5c6b84839e197.tar.gz garage-1a0bffae3491fae6af5a8d4defc5c6b84839e197.zip |
Merge pull request 'Use connection pooling in sqlite backend' (#779) from sqlite-r2d2 into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/779
Diffstat (limited to 'src/db/open.rs')
-rw-r--r-- | src/db/open.rs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/db/open.rs b/src/db/open.rs index ae135c4e..59d06f2e 100644 --- a/src/db/open.rs +++ b/src/db/open.rs @@ -91,14 +91,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 ---- |