mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 05:14:27 +01:00
Introduce an option to specify the maximum database size
This commit is contained in:
parent
394844062f
commit
ae77fe5a69
@ -52,6 +52,11 @@ struct Opt {
|
|||||||
#[structopt(long = "db", parse(from_os_str))]
|
#[structopt(long = "db", parse(from_os_str))]
|
||||||
database: PathBuf,
|
database: PathBuf,
|
||||||
|
|
||||||
|
/// The maximum size the database can take on disk. It is recommended to specify
|
||||||
|
/// the whole disk space (value must be a multiple of a page size).
|
||||||
|
#[structopt(long = "db-size", default_value = "107374182400")] // 100 GB
|
||||||
|
database_size: usize,
|
||||||
|
|
||||||
/// Number of parallel jobs, defaults to # of CPUs.
|
/// Number of parallel jobs, defaults to # of CPUs.
|
||||||
#[structopt(short, long)]
|
#[structopt(short, long)]
|
||||||
jobs: Option<usize>,
|
jobs: Option<usize>,
|
||||||
@ -419,8 +424,7 @@ fn main() -> anyhow::Result<()> {
|
|||||||
|
|
||||||
std::fs::create_dir_all(&opt.database)?;
|
std::fs::create_dir_all(&opt.database)?;
|
||||||
let env = EnvOpenOptions::new()
|
let env = EnvOpenOptions::new()
|
||||||
.map_size(100 * 1024 * 1024 * 1024) // 100 GB
|
.map_size(opt.database_size)
|
||||||
.max_readers(10)
|
|
||||||
.max_dbs(10)
|
.max_dbs(10)
|
||||||
.open(&opt.database)?;
|
.open(&opt.database)?;
|
||||||
|
|
||||||
|
@ -20,6 +20,11 @@ struct Opt {
|
|||||||
#[structopt(long = "db", parse(from_os_str))]
|
#[structopt(long = "db", parse(from_os_str))]
|
||||||
database: PathBuf,
|
database: PathBuf,
|
||||||
|
|
||||||
|
/// The maximum size the database can take on disk. It is recommended to specify
|
||||||
|
/// the whole disk space (value must be a multiple of a page size).
|
||||||
|
#[structopt(long = "db-size", default_value = "107374182400")] // 100 GB
|
||||||
|
database_size: usize,
|
||||||
|
|
||||||
/// Verbose mode (-v, -vv, -vvv, etc.)
|
/// Verbose mode (-v, -vv, -vvv, etc.)
|
||||||
#[structopt(short, long, parse(from_occurrences))]
|
#[structopt(short, long, parse(from_occurrences))]
|
||||||
verbose: usize,
|
verbose: usize,
|
||||||
@ -39,8 +44,7 @@ fn main() -> anyhow::Result<()> {
|
|||||||
|
|
||||||
std::fs::create_dir_all(&opt.database)?;
|
std::fs::create_dir_all(&opt.database)?;
|
||||||
let env = EnvOpenOptions::new()
|
let env = EnvOpenOptions::new()
|
||||||
.map_size(100 * 1024 * 1024 * 1024) // 100 GB
|
.map_size(opt.database_size)
|
||||||
.max_readers(10)
|
|
||||||
.max_dbs(10)
|
.max_dbs(10)
|
||||||
.open(&opt.database)?;
|
.open(&opt.database)?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user