From 683b5e9018c7688bf7302b56e2428f203b3fb99f Mon Sep 17 00:00:00 2001 From: trinity-1686a Date: Tue, 5 Nov 2024 10:12:15 +0100 Subject: [PATCH] wait for merge at end of local ingest --- quickwit/quickwit-cli/src/tool.rs | 6 +++++- quickwit/quickwit-indexing/src/actors/mod.rs | 2 +- quickwit/quickwit-indexing/src/lib.rs | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/quickwit/quickwit-cli/src/tool.rs b/quickwit/quickwit-cli/src/tool.rs index f5b2c512d33..cee9361bd6f 100644 --- a/quickwit/quickwit-cli/src/tool.rs +++ b/quickwit/quickwit-cli/src/tool.rs @@ -495,7 +495,11 @@ pub async fn local_ingest_docs_cli(args: LocalIngestDocsArgs) -> anyhow::Result< let statistics = start_statistics_reporting_loop(indexing_pipeline_handle, args.input_path_opt.is_none()) .await?; - merge_pipeline_handle.quit().await; + merge_pipeline_handle + .mailbox() + .ask(quickwit_indexing::FinishPendingMergesAndShutdownPipeline) + .await?; + merge_pipeline_handle.join().await; // Shutdown the indexing server. universe .send_exit_with_success(&indexing_server_mailbox) diff --git a/quickwit/quickwit-indexing/src/actors/mod.rs b/quickwit/quickwit-indexing/src/actors/mod.rs index ab70f06df35..31e6d32a032 100644 --- a/quickwit/quickwit-indexing/src/actors/mod.rs +++ b/quickwit/quickwit-indexing/src/actors/mod.rs @@ -41,7 +41,7 @@ pub use indexer::{Indexer, IndexerCounters}; pub use indexing_pipeline::{IndexingPipeline, IndexingPipelineParams}; pub use indexing_service::{IndexingService, IndexingServiceCounters, INDEXING_DIR_NAME}; pub use merge_executor::{combine_partition_ids, merge_split_attrs, MergeExecutor}; -pub use merge_pipeline::MergePipeline; +pub use merge_pipeline::{FinishPendingMergesAndShutdownPipeline, MergePipeline}; pub(crate) use merge_planner::{MergePlanner, RunFinalizeMergePolicyAndQuit}; pub use merge_scheduler_service::{schedule_merge, MergePermit, MergeSchedulerService}; pub use merge_split_downloader::MergeSplitDownloader; diff --git a/quickwit/quickwit-indexing/src/lib.rs b/quickwit/quickwit-indexing/src/lib.rs index 53a0b37b3a9..8d26d490110 100644 --- a/quickwit/quickwit-indexing/src/lib.rs +++ b/quickwit/quickwit-indexing/src/lib.rs @@ -31,8 +31,8 @@ use tracing::info; use crate::actors::MergeSchedulerService; pub use crate::actors::{ - IndexingError, IndexingPipeline, IndexingPipelineParams, IndexingService, PublisherType, - Sequencer, SplitsUpdateMailbox, + FinishPendingMergesAndShutdownPipeline, IndexingError, IndexingPipeline, + IndexingPipelineParams, IndexingService, PublisherType, Sequencer, SplitsUpdateMailbox, }; pub use crate::controlled_directory::ControlledDirectory; use crate::models::IndexingStatistics;