From 693ba8dd15280fe4be1f06fbc27465ff6d7fa551 Mon Sep 17 00:00:00 2001
From: Tamo <tamo@meilisearch.com>
Date: Wed, 21 Feb 2024 14:33:40 +0100
Subject: [PATCH] rename the cli parameter

---
 meilisearch/src/analytics/segment_analytics.rs |  6 +++---
 meilisearch/src/lib.rs                         |  2 +-
 meilisearch/src/option.rs                      | 14 +++++++-------
 meilisearch/src/routes/mod.rs                  |  4 ++--
 meilisearch/tests/index/create_index.rs        |  3 ++-
 5 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/meilisearch/src/analytics/segment_analytics.rs b/meilisearch/src/analytics/segment_analytics.rs
index a78b0d11b..8bb7e8d81 100644
--- a/meilisearch/src/analytics/segment_analytics.rs
+++ b/meilisearch/src/analytics/segment_analytics.rs
@@ -250,7 +250,7 @@ impl super::Analytics for SegmentAnalytics {
 struct Infos {
     env: String,
     experimental_enable_metrics: bool,
-    experimental_ha_parameters: bool,
+    experimental_replication_parameters: bool,
     experimental_enable_logs_route: bool,
     experimental_reduce_indexing_memory_usage: bool,
     experimental_max_number_of_batched_tasks: usize,
@@ -289,7 +289,7 @@ impl From<Opt> for Infos {
         let Opt {
             db_path,
             experimental_enable_metrics,
-            experimental_ha_parameters,
+            experimental_replication_parameters,
             experimental_enable_logs_route,
             experimental_reduce_indexing_memory_usage,
             experimental_max_number_of_batched_tasks,
@@ -337,7 +337,7 @@ impl From<Opt> for Infos {
         Self {
             env,
             experimental_enable_metrics,
-            experimental_ha_parameters,
+            experimental_replication_parameters,
             experimental_enable_logs_route,
             experimental_reduce_indexing_memory_usage,
             db_path: db_path != PathBuf::from("./data.ms"),
diff --git a/meilisearch/src/lib.rs b/meilisearch/src/lib.rs
index de26b771e..1ab161564 100644
--- a/meilisearch/src/lib.rs
+++ b/meilisearch/src/lib.rs
@@ -288,7 +288,7 @@ fn open_or_create_database_unchecked(
             enable_mdb_writemap: opt.experimental_reduce_indexing_memory_usage,
             indexer_config: (&opt.indexer_options).try_into()?,
             autobatching_enabled: true,
-            cleanup_enabled: !opt.experimental_ha_parameters,
+            cleanup_enabled: !opt.experimental_replication_parameters,
             max_number_of_tasks: 1_000_000,
             max_number_of_batched_tasks: opt.experimental_max_number_of_batched_tasks,
             index_growth_amount: byte_unit::Byte::from_str("10GiB").unwrap().get_bytes() as usize,
diff --git a/meilisearch/src/option.rs b/meilisearch/src/option.rs
index f932abac6..e6ff4f2a1 100644
--- a/meilisearch/src/option.rs
+++ b/meilisearch/src/option.rs
@@ -51,7 +51,7 @@ 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_DUMP_DIR: &str = "MEILI_DUMP_DIR";
 const MEILI_LOG_LEVEL: &str = "MEILI_LOG_LEVEL";
-const MEILI_EXPERIMENTAL_HA_PARAMETERS: &str = "MEILI_EXPERIMENTAL_HA_PARAMETERS";
+const MEILI_EXPERIMENTAL_REPLICATION_PARAMETERS: &str = "MEILI_EXPERIMENTAL_REPLICATION_PARAMETERS";
 const MEILI_EXPERIMENTAL_ENABLE_LOGS_ROUTE: &str = "MEILI_EXPERIMENTAL_ENABLE_LOGS_ROUTE";
 const MEILI_EXPERIMENTAL_ENABLE_METRICS: &str = "MEILI_EXPERIMENTAL_ENABLE_METRICS";
 const MEILI_EXPERIMENTAL_REDUCE_INDEXING_MEMORY_USAGE: &str =
@@ -318,15 +318,15 @@ pub struct Opt {
     #[serde(default)]
     pub experimental_enable_logs_route: bool,
 
-    /// Enable multiple features that helps you to run meilisearch in a high availability context.
+    /// Enable multiple features that helps you to run meilisearch in a replicated context.
     /// For more information, see: <https://github.com/orgs/meilisearch/discussions/725>
     ///
     /// - /!\ Disable the automatic clean up of old processed tasks, you're in charge of that now
     /// - Lets you specify a custom task ID upon registering a task
     /// - Lets you execute dry-register a task (get an answer from the route but nothing is actually registered in meilisearch and it won't be processed)
-    #[clap(long, env = MEILI_EXPERIMENTAL_HA_PARAMETERS)]
+    #[clap(long, env = MEILI_EXPERIMENTAL_REPLICATION_PARAMETERS)]
     #[serde(default)]
-    pub experimental_ha_parameters: bool,
+    pub experimental_replication_parameters: bool,
 
     /// Experimental RAM reduction during indexing, do not use in production, see: <https://github.com/meilisearch/product/discussions/652>
     #[clap(long, env = MEILI_EXPERIMENTAL_REDUCE_INDEXING_MEMORY_USAGE)]
@@ -434,7 +434,7 @@ impl Opt {
             no_analytics,
             experimental_enable_metrics,
             experimental_enable_logs_route,
-            experimental_ha_parameters,
+            experimental_replication_parameters,
             experimental_reduce_indexing_memory_usage,
         } = self;
         export_to_env_if_not_present(MEILI_DB_PATH, db_path);
@@ -492,8 +492,8 @@ impl Opt {
             experimental_enable_metrics.to_string(),
         );
         export_to_env_if_not_present(
-            MEILI_EXPERIMENTAL_HA_PARAMETERS,
-            experimental_ha_parameters.to_string(),
+            MEILI_EXPERIMENTAL_REPLICATION_PARAMETERS,
+            experimental_replication_parameters.to_string(),
         );
         export_to_env_if_not_present(
             MEILI_EXPERIMENTAL_ENABLE_LOGS_ROUTE,
diff --git a/meilisearch/src/routes/mod.rs b/meilisearch/src/routes/mod.rs
index f98d4b4de..249103e12 100644
--- a/meilisearch/src/routes/mod.rs
+++ b/meilisearch/src/routes/mod.rs
@@ -47,7 +47,7 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
 }
 
 pub fn get_task_id(req: &HttpRequest, opt: &Opt) -> Result<Option<TaskId>, ResponseError> {
-    if !opt.experimental_ha_parameters {
+    if !opt.experimental_replication_parameters {
         return Ok(None);
     }
     let task_id = req
@@ -78,7 +78,7 @@ pub fn get_task_id(req: &HttpRequest, opt: &Opt) -> Result<Option<TaskId>, Respo
 }
 
 pub fn is_dry_run(req: &HttpRequest, opt: &Opt) -> Result<bool, ResponseError> {
-    if !opt.experimental_ha_parameters {
+    if !opt.experimental_replication_parameters {
         return Ok(false);
     }
     Ok(req
diff --git a/meilisearch/tests/index/create_index.rs b/meilisearch/tests/index/create_index.rs
index 7a678624c..b309b83c6 100644
--- a/meilisearch/tests/index/create_index.rs
+++ b/meilisearch/tests/index/create_index.rs
@@ -205,7 +205,8 @@ async fn error_create_with_invalid_index_uid() {
 async fn send_task_id() {
     let temp = tempfile::tempdir().unwrap();
 
-    let options = Opt { experimental_ha_parameters: true, ..default_settings(temp.path()) };
+    let options =
+        Opt { experimental_replication_parameters: true, ..default_settings(temp.path()) };
     let server = Server::new_with_options(options).await.unwrap();
 
     let app = server.init_web_app().await;