diff options
author | Alex <alex@adnab.me> | 2023-09-11 16:48:14 +0000 |
---|---|---|
committer | Alex <alex@adnab.me> | 2023-09-11 16:48:14 +0000 |
commit | fc635f7072e1def6e45123cd3abc4d267b555fc3 (patch) | |
tree | 8e4fa625c3c9ecdc93575ce0bb45ec301ed81227 /src/model | |
parent | 5f86b48f9766019c6c74d14c2fba8c1176423cfb (diff) | |
parent | f8b3883611578713ecb8bcacaf24ca8029e7b739 (diff) | |
download | garage-fc635f7072e1def6e45123cd3abc4d267b555fc3.tar.gz garage-fc635f7072e1def6e45123cd3abc4d267b555fc3.zip |
Merge pull request 'make lmdb's map_size configurable (fix #628)' (#630) from configurable-map-size into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/630
Diffstat (limited to 'src/model')
-rw-r--r-- | src/model/garage.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/model/garage.rs b/src/model/garage.rs index 3daa1b33..a432aa7a 100644 --- a/src/model/garage.rs +++ b/src/model/garage.rs @@ -95,7 +95,7 @@ impl Garage { info!("Opening Sled database at: {}", db_path.display()); let db = db::sled_adapter::sled::Config::default() .path(&db_path) - .cache_capacity(config.sled_cache_capacity) + .cache_capacity(config.sled_cache_capacity as u64) .flush_every_ms(Some(config.sled_flush_every_ms)) .open() .ok_or_message("Unable to open sled DB")?; @@ -125,7 +125,10 @@ impl Garage { info!("Opening LMDB database at: {}", db_path.display()); std::fs::create_dir_all(&db_path) .ok_or_message("Unable to create LMDB data directory")?; - let map_size = garage_db::lmdb_adapter::recommended_map_size(); + let map_size = match config.lmdb_map_size { + v if v == usize::default() => garage_db::lmdb_adapter::recommended_map_size(), + v => v - (v % 4096), + }; use db::lmdb_adapter::heed; let mut env_builder = heed::EnvOpenOptions::new(); @@ -142,6 +145,7 @@ impl Garage { "OutOfMemory error while trying to open LMDB database. This can happen \ if your operating system is not allowing you to use sufficient virtual \ memory address space. Please check that no limit is set (ulimit -v). \ + You may also try to set a smaller `lmdb_map_size` configuration parameter. \ On 32-bit machines, you should probably switch to another database engine.".into())) } x => x.ok_or_message("Unable to open LMDB DB")?, |