Skip to content

Commit

Permalink
fix(homeserver): increase the LMDB map size to 10TB to avoid MDB_MAP_…
Browse files Browse the repository at this point in the history
…FULL
  • Loading branch information
Nuhvi committed Sep 27, 2024
1 parent 6e42cd3 commit e01a9c4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pubky-homeserver/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub mod tables;
use tables::{Tables, TABLES_COUNT};

pub const MAX_LIST_LIMIT: u16 = 100;
pub const DEFAULT_MAP_SIZE: usize = 10995116277760; // 10TB (not = disk-space used)

#[derive(Debug, Clone)]
pub struct DB {
Expand All @@ -21,7 +22,13 @@ impl DB {
pub fn open(storage: &Path) -> anyhow::Result<Self> {
fs::create_dir_all(storage).unwrap();

let env = unsafe { EnvOpenOptions::new().max_dbs(TABLES_COUNT).open(storage) }?;
let env = unsafe {
EnvOpenOptions::new()
.max_dbs(TABLES_COUNT)
// TODO: Add a configuration option?
.map_size(DEFAULT_MAP_SIZE)
.open(storage)
}?;

let tables = migrations::run(&env)?;

Expand Down

0 comments on commit e01a9c4

Please sign in to comment.