diff --git a/src/bin/indexer.rs b/src/bin/indexer.rs index 9cad5382d..8bfdeb80e 100644 --- a/src/bin/indexer.rs +++ b/src/bin/indexer.rs @@ -52,6 +52,11 @@ struct Opt { #[structopt(long = "db", parse(from_os_str))] 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. #[structopt(short, long)] jobs: Option, @@ -419,8 +424,7 @@ fn main() -> anyhow::Result<()> { std::fs::create_dir_all(&opt.database)?; let env = EnvOpenOptions::new() - .map_size(100 * 1024 * 1024 * 1024) // 100 GB - .max_readers(10) + .map_size(opt.database_size) .max_dbs(10) .open(&opt.database)?; diff --git a/src/bin/search.rs b/src/bin/search.rs index 9ecbc1676..bd1adfd65 100644 --- a/src/bin/search.rs +++ b/src/bin/search.rs @@ -20,6 +20,11 @@ struct Opt { #[structopt(long = "db", parse(from_os_str))] 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.) #[structopt(short, long, parse(from_occurrences))] verbose: usize, @@ -39,8 +44,7 @@ fn main() -> anyhow::Result<()> { std::fs::create_dir_all(&opt.database)?; let env = EnvOpenOptions::new() - .map_size(100 * 1024 * 1024 * 1024) // 100 GB - .max_readers(10) + .map_size(opt.database_size) .max_dbs(10) .open(&opt.database)?;