aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-06-06 16:44:47 +0200
committerAlex Auvolat <alex@adnab.me>2022-06-06 16:44:47 +0200
commitfd2fe18de3eb245aaab78abf924301e3d4a1734f (patch)
tree0532d693277195f625b5b5cbe51b6b3c12344bbe
parentc3c8d59c996061a2a4280820915a6dcd94cf496c (diff)
downloadgarage-fd2fe18de3eb245aaab78abf924301e3d4a1734f.tar.gz
garage-fd2fe18de3eb245aaab78abf924301e3d4a1734f.zip
in db convert: map size up to 1TB on 64-bit systems
-rw-r--r--src/db/bin/convert.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/db/bin/convert.rs b/src/db/bin/convert.rs
index 636bd834..e5778abb 100644
--- a/src/db/bin/convert.rs
+++ b/src/db/bin/convert.rs
@@ -54,9 +54,17 @@ fn open_db(path: PathBuf, engine: String) -> Result<Db> {
std::fs::create_dir_all(&path).map_err(|e| {
Error(format!("Unable to create LMDB data directory: {}", e).into())
})?;
+
+ let map_size = if u32::MAX as usize == usize::MAX {
+ eprintln!("LMDB is not recommended on 32-bit systems, database size will be limited");
+ 1usize << 30 // 1GB for 32-bit systems
+ } else {
+ 1usize << 40 // 1TB for 64-bit systems
+ };
+
let db = lmdb_adapter::heed::EnvOpenOptions::new()
.max_dbs(100)
- .map_size(1usize << 30)
+ .map_size(map_size)
.open(&path)
.unwrap();
Ok(lmdb_adapter::LmdbDb::init(db))