Add an experimental cli flag to disable snapshot compaction

This commit is contained in:
Tamo 2025-05-14 15:50:05 +02:00
parent d9a527854a
commit 83e71cd7b9
7 changed files with 35 additions and 3 deletions

View file

@ -65,6 +65,7 @@ const MEILI_EXPERIMENTAL_LIMIT_BATCHED_TASKS_TOTAL_SIZE: &str =
"MEILI_EXPERIMENTAL_LIMIT_BATCHED_TASKS_SIZE";
const MEILI_EXPERIMENTAL_EMBEDDING_CACHE_ENTRIES: &str =
"MEILI_EXPERIMENTAL_EMBEDDING_CACHE_ENTRIES";
const MEILI_EXPERIMENTAL_NO_SNAPSHOT_COMPACTION: &str = "MEILI_EXPERIMENTAL_NO_SNAPSHOT_COMPACTION";
const DEFAULT_CONFIG_FILE_PATH: &str = "./config.toml";
const DEFAULT_DB_PATH: &str = "./data.ms";
const DEFAULT_HTTP_ADDR: &str = "localhost:7700";
@ -455,6 +456,15 @@ pub struct Opt {
#[serde(default = "default_embedding_cache_entries")]
pub experimental_embedding_cache_entries: usize,
/// Experimental no snapshot compaction feature.
///
/// When enabled, Meilisearch will not compact snapshots during creation.
///
/// For more information, see <https://github.com/orgs/meilisearch/discussions/833>.
#[clap(long, env = MEILI_EXPERIMENTAL_NO_SNAPSHOT_COMPACTION)]
#[serde(default)]
pub experimental_no_snapshot_compaction: bool,
#[serde(flatten)]
#[clap(flatten)]
pub indexer_options: IndexerOpts,
@ -559,6 +569,7 @@ impl Opt {
experimental_max_number_of_batched_tasks,
experimental_limit_batched_tasks_total_size,
experimental_embedding_cache_entries,
experimental_no_snapshot_compaction,
} = self;
export_to_env_if_not_present(MEILI_DB_PATH, db_path);
export_to_env_if_not_present(MEILI_HTTP_ADDR, http_addr);
@ -655,6 +666,10 @@ impl Opt {
MEILI_EXPERIMENTAL_EMBEDDING_CACHE_ENTRIES,
experimental_embedding_cache_entries.to_string(),
);
export_to_env_if_not_present(
MEILI_EXPERIMENTAL_NO_SNAPSHOT_COMPACTION,
experimental_no_snapshot_compaction.to_string(),
);
indexer_options.export_to_env();
}