aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2023-03-06 10:49:04 +0000
committerAlex <alex@adnab.me>2023-03-06 10:49:04 +0000
commit0d0906b066eb76111f3b427dce1c50eac083366c (patch)
tree9b30a53f8a974f26d18e72ed298c3213f01b77d2 /src/model
parent3d37be33a882049dcb712da14667f7904c6cb418 (diff)
parentb8123fb6cdf15ad21e5d254368c96f6f32ba8c3c (diff)
downloadgarage-0d0906b066eb76111f3b427dce1c50eac083366c.tar.gz
garage-0d0906b066eb76111f3b427dce1c50eac083366c.zip
Merge pull request 'Clearer error message when LMDB has oom error (fix #517)' (#519) from lmdb-oom-message into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/519
Diffstat (limited to 'src/model')
-rw-r--r--src/model/garage.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/model/garage.rs b/src/model/garage.rs
index 0a9ec608..3daa1b33 100644
--- a/src/model/garage.rs
+++ b/src/model/garage.rs
@@ -136,9 +136,16 @@ impl Garage {
env_builder.flag(heed::flags::Flags::MdbNoSync);
env_builder.flag(heed::flags::Flags::MdbNoMetaSync);
}
- let db = env_builder
- .open(&db_path)
- .ok_or_message("Unable to open LMDB DB")?;
+ let db = match env_builder.open(&db_path) {
+ Err(heed::Error::Io(e)) if e.kind() == std::io::ErrorKind::OutOfMemory => {
+ return Err(Error::Message(
+ "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). \
+ On 32-bit machines, you should probably switch to another database engine.".into()))
+ }
+ x => x.ok_or_message("Unable to open LMDB DB")?,
+ };
db::lmdb_adapter::LmdbDb::init(db)
}
#[cfg(not(feature = "lmdb"))]