mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 12:27:13 +02:00
Add support for configuring lmdb map size
This commit is contained in:
parent
899559a060
commit
c4287cdfac
5 changed files with 38 additions and 7 deletions
|
@ -5,7 +5,7 @@ use std::sync::Arc;
|
|||
use chrono::{DateTime, Utc};
|
||||
use heed::types::{SerdeBincode, Str};
|
||||
use log::error;
|
||||
use meilisearch_core::{Database, Error as MError, MResult, MainT, UpdateT};
|
||||
use meilisearch_core::{Database, DatabaseOptions, Error as MError, MResult, MainT, UpdateT};
|
||||
use sha2::Digest;
|
||||
use sysinfo::Pid;
|
||||
|
||||
|
@ -132,7 +132,12 @@ impl Data {
|
|||
let db_path = opt.db_path.clone();
|
||||
let server_pid = sysinfo::get_current_pid().unwrap();
|
||||
|
||||
let db = Arc::new(Database::open_or_create(opt.db_path).unwrap());
|
||||
let db_opt = DatabaseOptions {
|
||||
main_map_size: opt.main_map_size,
|
||||
update_map_size: opt.update_map_size
|
||||
};
|
||||
|
||||
let db = Arc::new(Database::open_or_create(opt.db_path, db_opt).unwrap());
|
||||
|
||||
let mut api_keys = ApiKeys {
|
||||
master: opt.master_key,
|
||||
|
|
|
@ -26,4 +26,12 @@ pub struct Opt {
|
|||
/// Do not send analytics to Meili.
|
||||
#[structopt(long, env = "MEILI_NO_ANALYTICS")]
|
||||
pub no_analytics: bool,
|
||||
}
|
||||
|
||||
/// The maximum size, in bytes, of the main lmdb database directory
|
||||
#[structopt(long, env = "MEILI_MAIN_MAP_SIZE", default_value = "meilisearch_core::DatabaseOptions::default().main_map_size")]
|
||||
pub main_map_size: usize,
|
||||
|
||||
/// The maximum size, in bytes, of the update lmdb database directory
|
||||
#[structopt(long, env = "MEILI_UPDATE_MAP_SIZE", default_value = "meilisearch_core::DatabaseOptions::default().update_map_size")]
|
||||
pub update_map_size: usize
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue