3175: Rename dump command from --dumps-dir to --dump-dir r=dureuill a=dureuill

# Pull Request

## Related issue
Fixes #3132 

## What does this PR do?
- Rename the dump commands, env variables and default config

## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!


Co-authored-by: Louis Dureuil <louis@meilisearch.com>
This commit is contained in:
bors[bot] 2022-12-06 09:49:42 +00:00 committed by GitHub
commit 3bef6e6690
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 15 deletions

View File

@ -56,7 +56,7 @@ disable_auto_batching = false
### DUMPS ### ### DUMPS ###
############# #############
dumps_dir = "dumps/" dump_dir = "dumps/"
# Sets the directory where Meilisearch will create dump files. # Sets the directory where Meilisearch will create dump files.
# https://docs.meilisearch.com/learn/configuration/instance_options.html#dumps-destination # https://docs.meilisearch.com/learn/configuration/instance_options.html#dumps-destination

View File

@ -216,7 +216,7 @@ struct Infos {
env: String, env: String,
db_path: bool, db_path: bool,
import_dump: bool, import_dump: bool,
dumps_dir: bool, dump_dir: bool,
ignore_missing_dump: bool, ignore_missing_dump: bool,
ignore_dump_if_db_exists: bool, ignore_dump_if_db_exists: bool,
import_snapshot: bool, import_snapshot: bool,
@ -272,7 +272,7 @@ impl From<Opt> for Infos {
import_dump, import_dump,
ignore_missing_dump, ignore_missing_dump,
ignore_dump_if_db_exists, ignore_dump_if_db_exists,
dumps_dir, dump_dir,
log_level, log_level,
indexer_options, indexer_options,
scheduler_options, scheduler_options,
@ -295,7 +295,7 @@ impl From<Opt> for Infos {
env, env,
db_path: db_path != PathBuf::from("./data.ms"), db_path: db_path != PathBuf::from("./data.ms"),
import_dump: import_dump.is_some(), import_dump: import_dump.is_some(),
dumps_dir: dumps_dir != PathBuf::from("dumps/"), dump_dir: dump_dir != PathBuf::from("dumps/"),
ignore_missing_dump, ignore_missing_dump,
ignore_dump_if_db_exists, ignore_dump_if_db_exists,
import_snapshot: import_snapshot.is_some(), import_snapshot: import_snapshot.is_some(),

View File

@ -121,7 +121,7 @@ pub fn setup_meilisearch(opt: &Opt) -> anyhow::Result<(Arc<IndexScheduler>, Auth
update_file_path: opt.db_path.join("update_files"), update_file_path: opt.db_path.join("update_files"),
indexes_path: opt.db_path.join("indexes"), indexes_path: opt.db_path.join("indexes"),
snapshots_path: opt.snapshot_dir.clone(), snapshots_path: opt.snapshot_dir.clone(),
dumps_path: opt.dumps_dir.clone(), dumps_path: opt.dump_dir.clone(),
task_db_size: opt.max_task_db_size.get_bytes() as usize, task_db_size: opt.max_task_db_size.get_bytes() as usize,
index_size: opt.max_index_size.get_bytes() as usize, index_size: opt.max_index_size.get_bytes() as usize,
indexer_config: (&opt.indexer_options).try_into()?, indexer_config: (&opt.indexer_options).try_into()?,

View File

@ -47,7 +47,7 @@ const MEILI_SNAPSHOT_INTERVAL_SEC: &str = "MEILI_SNAPSHOT_INTERVAL_SEC";
const MEILI_IMPORT_DUMP: &str = "MEILI_IMPORT_DUMP"; const MEILI_IMPORT_DUMP: &str = "MEILI_IMPORT_DUMP";
const MEILI_IGNORE_MISSING_DUMP: &str = "MEILI_IGNORE_MISSING_DUMP"; const MEILI_IGNORE_MISSING_DUMP: &str = "MEILI_IGNORE_MISSING_DUMP";
const MEILI_IGNORE_DUMP_IF_DB_EXISTS: &str = "MEILI_IGNORE_DUMP_IF_DB_EXISTS"; const MEILI_IGNORE_DUMP_IF_DB_EXISTS: &str = "MEILI_IGNORE_DUMP_IF_DB_EXISTS";
const MEILI_DUMPS_DIR: &str = "MEILI_DUMPS_DIR"; const MEILI_DUMP_DIR: &str = "MEILI_DUMP_DIR";
const MEILI_LOG_LEVEL: &str = "MEILI_LOG_LEVEL"; const MEILI_LOG_LEVEL: &str = "MEILI_LOG_LEVEL";
#[cfg(feature = "metrics")] #[cfg(feature = "metrics")]
const MEILI_ENABLE_METRICS_ROUTE: &str = "MEILI_ENABLE_METRICS_ROUTE"; const MEILI_ENABLE_METRICS_ROUTE: &str = "MEILI_ENABLE_METRICS_ROUTE";
@ -61,7 +61,7 @@ const DEFAULT_MAX_TASK_DB_SIZE: &str = "100 GiB";
const DEFAULT_HTTP_PAYLOAD_SIZE_LIMIT: &str = "100 MB"; const DEFAULT_HTTP_PAYLOAD_SIZE_LIMIT: &str = "100 MB";
const DEFAULT_SNAPSHOT_DIR: &str = "snapshots/"; const DEFAULT_SNAPSHOT_DIR: &str = "snapshots/";
const DEFAULT_SNAPSHOT_INTERVAL_SEC: u64 = 86400; const DEFAULT_SNAPSHOT_INTERVAL_SEC: u64 = 86400;
const DEFAULT_DUMPS_DIR: &str = "dumps/"; const DEFAULT_DUMP_DIR: &str = "dumps/";
const DEFAULT_LOG_LEVEL: &str = "INFO"; const DEFAULT_LOG_LEVEL: &str = "INFO";
const MEILI_MAX_INDEXING_MEMORY: &str = "MEILI_MAX_INDEXING_MEMORY"; const MEILI_MAX_INDEXING_MEMORY: &str = "MEILI_MAX_INDEXING_MEMORY";
@ -219,9 +219,9 @@ pub struct Opt {
pub ignore_dump_if_db_exists: bool, pub ignore_dump_if_db_exists: bool,
/// Sets the directory where Meilisearch will create dump files. /// Sets the directory where Meilisearch will create dump files.
#[clap(long, env = MEILI_DUMPS_DIR, default_value_os_t = default_dumps_dir())] #[clap(long, env = MEILI_DUMP_DIR, default_value_os_t = default_dump_dir())]
#[serde(default = "default_dumps_dir")] #[serde(default = "default_dump_dir")]
pub dumps_dir: PathBuf, pub dump_dir: PathBuf,
/// Defines how much detail should be present in Meilisearch's logs. /// Defines how much detail should be present in Meilisearch's logs.
/// ///
@ -320,7 +320,7 @@ impl Opt {
snapshot_dir, snapshot_dir,
schedule_snapshot, schedule_snapshot,
snapshot_interval_sec, snapshot_interval_sec,
dumps_dir, dump_dir,
log_level, log_level,
indexer_options, indexer_options,
scheduler_options, scheduler_options,
@ -373,7 +373,7 @@ impl Opt {
MEILI_SNAPSHOT_INTERVAL_SEC, MEILI_SNAPSHOT_INTERVAL_SEC,
snapshot_interval_sec.to_string(), snapshot_interval_sec.to_string(),
); );
export_to_env_if_not_present(MEILI_DUMPS_DIR, dumps_dir); export_to_env_if_not_present(MEILI_DUMP_DIR, dump_dir);
export_to_env_if_not_present(MEILI_LOG_LEVEL, log_level); export_to_env_if_not_present(MEILI_LOG_LEVEL, log_level);
#[cfg(feature = "metrics")] #[cfg(feature = "metrics")]
{ {
@ -708,8 +708,8 @@ fn default_snapshot_interval_sec() -> u64 {
DEFAULT_SNAPSHOT_INTERVAL_SEC DEFAULT_SNAPSHOT_INTERVAL_SEC
} }
fn default_dumps_dir() -> PathBuf { fn default_dump_dir() -> PathBuf {
PathBuf::from(DEFAULT_DUMPS_DIR) PathBuf::from(DEFAULT_DUMP_DIR)
} }
fn default_log_level() -> String { fn default_log_level() -> String {

View File

@ -184,7 +184,7 @@ impl Server {
pub fn default_settings(dir: impl AsRef<Path>) -> Opt { pub fn default_settings(dir: impl AsRef<Path>) -> Opt {
Opt { Opt {
db_path: dir.as_ref().join("db"), db_path: dir.as_ref().join("db"),
dumps_dir: dir.as_ref().join("dump"), dump_dir: dir.as_ref().join("dumps"),
env: "development".to_owned(), env: "development".to_owned(),
#[cfg(all(not(debug_assertions), feature = "analytics"))] #[cfg(all(not(debug_assertions), feature = "analytics"))]
no_analytics: true, no_analytics: true,