rename the cli parameter

This commit is contained in:
Tamo 2024-02-21 14:33:40 +01:00
parent 60510e037b
commit bbf3fb88ca
5 changed files with 15 additions and 22 deletions

View File

@ -253,7 +253,7 @@ struct Infos {
env: String, env: String,
experimental_enable_metrics: bool, experimental_enable_metrics: bool,
experimental_logs_mode: LogMode, experimental_logs_mode: LogMode,
experimental_ha_parameters: bool, experimental_replication_parameters: bool,
experimental_enable_logs_route: bool, experimental_enable_logs_route: bool,
experimental_reduce_indexing_memory_usage: bool, experimental_reduce_indexing_memory_usage: bool,
experimental_max_number_of_batched_tasks: usize, experimental_max_number_of_batched_tasks: usize,
@ -292,12 +292,8 @@ impl From<Opt> for Infos {
let Opt { let Opt {
db_path, db_path,
experimental_enable_metrics, experimental_enable_metrics,
<<<<<<< HEAD
experimental_logs_mode, experimental_logs_mode,
||||||| parent of 01ae46dd8 (add an experimental cli parameter to allow specifying your task id) experimental_replication_parameters,
=======
experimental_ha_parameters,
>>>>>>> 01ae46dd8 (add an experimental cli parameter to allow specifying your task id)
experimental_enable_logs_route, experimental_enable_logs_route,
experimental_reduce_indexing_memory_usage, experimental_reduce_indexing_memory_usage,
experimental_max_number_of_batched_tasks, experimental_max_number_of_batched_tasks,
@ -345,12 +341,8 @@ impl From<Opt> for Infos {
Self { Self {
env, env,
experimental_enable_metrics, experimental_enable_metrics,
<<<<<<< HEAD
experimental_logs_mode, experimental_logs_mode,
||||||| parent of 01ae46dd8 (add an experimental cli parameter to allow specifying your task id) experimental_replication_parameters,
=======
experimental_ha_parameters,
>>>>>>> 01ae46dd8 (add an experimental cli parameter to allow specifying your task id)
experimental_enable_logs_route, experimental_enable_logs_route,
experimental_reduce_indexing_memory_usage, experimental_reduce_indexing_memory_usage,
db_path: db_path != PathBuf::from("./data.ms"), db_path: db_path != PathBuf::from("./data.ms"),

View File

@ -302,7 +302,7 @@ fn open_or_create_database_unchecked(
enable_mdb_writemap: opt.experimental_reduce_indexing_memory_usage, enable_mdb_writemap: opt.experimental_reduce_indexing_memory_usage,
indexer_config: (&opt.indexer_options).try_into()?, indexer_config: (&opt.indexer_options).try_into()?,
autobatching_enabled: true, 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_tasks: 1_000_000,
max_number_of_batched_tasks: opt.experimental_max_number_of_batched_tasks, 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, index_growth_amount: byte_unit::Byte::from_str("10GiB").unwrap().get_bytes() as usize,

View File

@ -52,7 +52,7 @@ const MEILI_IGNORE_DUMP_IF_DB_EXISTS: &str = "MEILI_IGNORE_DUMP_IF_DB_EXISTS";
const MEILI_DUMP_DIR: &str = "MEILI_DUMP_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";
const MEILI_EXPERIMENTAL_LOGS_MODE: &str = "MEILI_EXPERIMENTAL_LOGS_MODE"; const MEILI_EXPERIMENTAL_LOGS_MODE: &str = "MEILI_EXPERIMENTAL_LOGS_MODE";
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_LOGS_ROUTE: &str = "MEILI_EXPERIMENTAL_ENABLE_LOGS_ROUTE";
const MEILI_EXPERIMENTAL_ENABLE_METRICS: &str = "MEILI_EXPERIMENTAL_ENABLE_METRICS"; const MEILI_EXPERIMENTAL_ENABLE_METRICS: &str = "MEILI_EXPERIMENTAL_ENABLE_METRICS";
const MEILI_EXPERIMENTAL_REDUCE_INDEXING_MEMORY_USAGE: &str = const MEILI_EXPERIMENTAL_REDUCE_INDEXING_MEMORY_USAGE: &str =
@ -359,15 +359,15 @@ pub struct Opt {
#[serde(default)] #[serde(default)]
pub experimental_enable_logs_route: bool, 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> /// 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 /// - /!\ 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 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) /// - 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)] #[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> /// 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)] #[clap(long, env = MEILI_EXPERIMENTAL_REDUCE_INDEXING_MEMORY_USAGE)]
@ -476,7 +476,7 @@ impl Opt {
experimental_enable_metrics, experimental_enable_metrics,
experimental_logs_mode, experimental_logs_mode,
experimental_enable_logs_route, experimental_enable_logs_route,
experimental_ha_parameters, experimental_replication_parameters,
experimental_reduce_indexing_memory_usage, experimental_reduce_indexing_memory_usage,
} = self; } = self;
export_to_env_if_not_present(MEILI_DB_PATH, db_path); export_to_env_if_not_present(MEILI_DB_PATH, db_path);
@ -538,8 +538,8 @@ impl Opt {
experimental_logs_mode.to_string(), experimental_logs_mode.to_string(),
); );
export_to_env_if_not_present( export_to_env_if_not_present(
MEILI_EXPERIMENTAL_HA_PARAMETERS, MEILI_EXPERIMENTAL_REPLICATION_PARAMETERS,
experimental_ha_parameters.to_string(), experimental_replication_parameters.to_string(),
); );
export_to_env_if_not_present( export_to_env_if_not_present(
MEILI_EXPERIMENTAL_ENABLE_LOGS_ROUTE, MEILI_EXPERIMENTAL_ENABLE_LOGS_ROUTE,

View File

@ -47,7 +47,7 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
} }
pub fn get_task_id(req: &HttpRequest, opt: &Opt) -> Result<Option<TaskId>, ResponseError> { 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); return Ok(None);
} }
let task_id = req 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> { 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); return Ok(false);
} }
Ok(req Ok(req

View File

@ -205,7 +205,8 @@ async fn error_create_with_invalid_index_uid() {
async fn send_task_id() { async fn send_task_id() {
let temp = tempfile::tempdir().unwrap(); 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 server = Server::new_with_options(options).await.unwrap();
let app = server.init_web_app().await; let app = server.init_web_app().await;