This commit is contained in:
kryesh 2026-06-17 06:59:16 +00:00 committed by GitHub
commit fc7e498c95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View file

@ -349,6 +349,12 @@ impl<D: Document> IndexWriter<D> {
&self.index
}
/// Check if there are any merging threads
/// Does not block
pub fn has_merging_threads(&self) -> bool {
self.segment_updater.has_merging_threads()
}
/// If there are some merging threads, blocks until they all finish their work and
/// then drop the `IndexWriter`.
pub fn wait_merging_threads(mut self) -> crate::Result<()> {

View file

@ -676,6 +676,11 @@ impl SegmentUpdater {
Ok(after_merge_segment_meta)
}
/// Check if there are still pending merges without blocking
pub fn has_merging_threads(&self) -> bool {
self.merge_operations.len() > 0
}
/// Wait for current merging threads.
///
/// Upon termination of the current merging threads,