From 513e61e9a392069e43eaa84ccb03d6dbf2a6704e Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Mon, 25 Sep 2023 14:48:41 +0200 Subject: [PATCH] Remove the experimental CLI flag --- index-scheduler/src/lib.rs | 29 ++++++++----------- .../src/analytics/segment_analytics.rs | 1 - meilisearch/src/lib.rs | 1 - meilisearch/src/main.rs | 2 -- meilisearch/src/option.rs | 11 ------- 5 files changed, 12 insertions(+), 32 deletions(-) diff --git a/index-scheduler/src/lib.rs b/index-scheduler/src/lib.rs index f0842a1af..c8a7f0c8b 100644 --- a/index-scheduler/src/lib.rs +++ b/index-scheduler/src/lib.rs @@ -258,8 +258,6 @@ pub struct IndexSchedulerOptions { /// The maximum number of tasks stored in the task queue before starting /// to auto schedule task deletions. pub max_number_of_tasks: usize, - /// Weither we need to export indexation puffin reports. - pub profile_with_puffin: bool, /// The experimental features enabled for this instance. pub instance_features: InstanceTogglableFeatures, } @@ -318,8 +316,8 @@ pub struct IndexScheduler { /// the finished tasks automatically. pub(crate) max_number_of_tasks: usize, - /// Wether we must output indexation profiling files to disk. - pub(crate) puffin_frame: Option>, + /// A frame to output the indexation profiling files to disk. + pub(crate) puffin_frame: Arc, /// The path used to create the dumps. pub(crate) dumps_path: PathBuf, @@ -465,9 +463,7 @@ impl IndexScheduler { env, // we want to start the loop right away in case meilisearch was ctrl+Ced while processing things wake_up: Arc::new(SignalEvent::auto(true)), - puffin_frame: options - .profile_with_puffin - .then(|| Arc::new(puffin::GlobalFrameView::default())), + puffin_frame: Arc::new(puffin::GlobalFrameView::default()), autobatching_enabled: options.autobatching_enabled, max_number_of_tasks: options.max_number_of_tasks, dumps_path: options.dumps_path, @@ -1087,16 +1083,15 @@ impl IndexScheduler { // Let's write the previous frame to disk but only if // the user wanted to profile with puffin. if puffin_enabled { - if let Some(global_frame_view) = &self.puffin_frame { - let mut frame_view = global_frame_view.lock(); - if !frame_view.is_empty() { - let now = OffsetDateTime::now_utc(); - let mut file = File::create(format!("{}.puffin", now))?; - frame_view.save_to_writer(&mut file)?; - file.sync_all()?; - // We erase everything on this frame as it is not more useful. - *frame_view = FrameView::default(); - } + let mut frame_view = self.puffin_frame.lock(); + if !frame_view.is_empty() { + let now = OffsetDateTime::now_utc(); + let mut file = File::create(format!("{}.puffin", now))?; + frame_view.save_to_writer(&mut file)?; + file.sync_all()?; + // We erase this frame view as it is no more useful. We want to + // measure the new frames now that we exported the previous ones. + *frame_view = FrameView::default(); } } diff --git a/meilisearch/src/analytics/segment_analytics.rs b/meilisearch/src/analytics/segment_analytics.rs index d7869525e..2f0014ab7 100644 --- a/meilisearch/src/analytics/segment_analytics.rs +++ b/meilisearch/src/analytics/segment_analytics.rs @@ -285,7 +285,6 @@ impl From for Infos { db_path, experimental_enable_metrics, experimental_reduce_indexing_memory_usage, - experimental_profile_with_puffin: _, http_addr, master_key: _, env, diff --git a/meilisearch/src/lib.rs b/meilisearch/src/lib.rs index cf00789b3..ef821f49f 100644 --- a/meilisearch/src/lib.rs +++ b/meilisearch/src/lib.rs @@ -237,7 +237,6 @@ fn open_or_create_database_unchecked( indexer_config: (&opt.indexer_options).try_into()?, autobatching_enabled: true, max_number_of_tasks: 1_000_000, - profile_with_puffin: opt.experimental_profile_with_puffin, index_growth_amount: byte_unit::Byte::from_str("10GiB").unwrap().get_bytes() as usize, index_count: DEFAULT_INDEX_COUNT, instance_features, diff --git a/meilisearch/src/main.rs b/meilisearch/src/main.rs index b53335ed2..246d62c3b 100644 --- a/meilisearch/src/main.rs +++ b/meilisearch/src/main.rs @@ -30,8 +30,6 @@ fn setup(opt: &Opt) -> anyhow::Result<()> { async fn main() -> anyhow::Result<()> { let (opt, config_read_from) = Opt::try_build()?; - puffin::set_scopes_on(opt.experimental_profile_with_puffin); - anyhow::ensure!( !(cfg!(windows) && opt.experimental_reduce_indexing_memory_usage), "The `experimental-reduce-indexing-memory-usage` flag is not supported on Windows" diff --git a/meilisearch/src/option.rs b/meilisearch/src/option.rs index 569497b9f..b8489c3e3 100644 --- a/meilisearch/src/option.rs +++ b/meilisearch/src/option.rs @@ -51,7 +51,6 @@ const MEILI_LOG_LEVEL: &str = "MEILI_LOG_LEVEL"; const MEILI_EXPERIMENTAL_ENABLE_METRICS: &str = "MEILI_EXPERIMENTAL_ENABLE_METRICS"; const MEILI_EXPERIMENTAL_REDUCE_INDEXING_MEMORY_USAGE: &str = "MEILI_EXPERIMENTAL_REDUCE_INDEXING_MEMORY_USAGE"; -const MEILI_EXPERIMENTAL_PROFILE_WITH_PUFFIN: &str = "MEILI_EXPERIMENTAL_PROFILE_WITH_PUFFIN"; const DEFAULT_CONFIG_FILE_PATH: &str = "./config.toml"; const DEFAULT_DB_PATH: &str = "./data.ms"; @@ -302,11 +301,6 @@ pub struct Opt { #[serde(default)] pub experimental_reduce_indexing_memory_usage: bool, - /// Experimental flag to export puffin reports, see: - #[clap(long, env = MEILI_EXPERIMENTAL_PROFILE_WITH_PUFFIN)] - #[serde(default)] - pub experimental_profile_with_puffin: bool, - #[serde(flatten)] #[clap(flatten)] pub indexer_options: IndexerOpts, @@ -400,7 +394,6 @@ impl Opt { no_analytics, experimental_enable_metrics: enable_metrics_route, experimental_reduce_indexing_memory_usage: reduce_indexing_memory_usage, - experimental_profile_with_puffin, } = self; export_to_env_if_not_present(MEILI_DB_PATH, db_path); export_to_env_if_not_present(MEILI_HTTP_ADDR, http_addr); @@ -446,10 +439,6 @@ impl Opt { MEILI_EXPERIMENTAL_REDUCE_INDEXING_MEMORY_USAGE, reduce_indexing_memory_usage.to_string(), ); - export_to_env_if_not_present( - MEILI_EXPERIMENTAL_PROFILE_WITH_PUFFIN, - experimental_profile_with_puffin.to_string(), - ); indexer_options.export_to_env(); }