aboutsummaryrefslogtreecommitdiff
path: root/src/db/bin/convert.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-05-17 14:30:53 +0200
committerAlex Auvolat <alex@adnab.me>2023-05-17 14:30:53 +0200
commit19639705e6242861bd43a123456793e2d8f2c69a (patch)
tree17710b95f770cdde8e6405479f8262a12bcf6a13 /src/db/bin/convert.rs
parent351d734e6c035a6f22f9fe0d62a783a81a134f45 (diff)
downloadgarage-19639705e6242861bd43a123456793e2d8f2c69a.tar.gz
garage-19639705e6242861bd43a123456793e2d8f2c69a.zip
Mark sled as deprecated, make lmdb default, and improve sqlite and lmdb defaults
Diffstat (limited to 'src/db/bin/convert.rs')
-rw-r--r--src/db/bin/convert.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/db/bin/convert.rs b/src/db/bin/convert.rs
index bbde2048..957deedf 100644
--- a/src/db/bin/convert.rs
+++ b/src/db/bin/convert.rs
@@ -48,6 +48,8 @@ fn open_db(path: PathBuf, engine: String) -> Result<Db> {
}
"sqlite" | "sqlite3" | "rusqlite" => {
let db = sqlite_adapter::rusqlite::Connection::open(&path)?;
+ db.pragma_update(None, "journal_mode", &"WAL")?;
+ db.pragma_update(None, "synchronous", &"NORMAL")?;
Ok(sqlite_adapter::SqliteDb::init(db))
}
"lmdb" | "heed" => {
@@ -57,11 +59,13 @@ fn open_db(path: PathBuf, engine: String) -> Result<Db> {
let map_size = lmdb_adapter::recommended_map_size();
- let db = lmdb_adapter::heed::EnvOpenOptions::new()
- .max_dbs(100)
- .map_size(map_size)
- .open(&path)
- .unwrap();
+ let mut env_builder = lmdb_adapter::heed::EnvOpenOptions::new();
+ env_builder.max_dbs(100);
+ env_builder.map_size(map_size);
+ unsafe {
+ env_builder.flag(heed::flags::Flags::MdbNoMetaSync);
+ }
+ let db = env_builder.open(&path)?;
Ok(lmdb_adapter::LmdbDb::init(db))
}
e => Err(Error(format!("Invalid DB engine: {}", e).into())),