diff --git a/src/core/index.rs b/src/core/index.rs index cffa15f08b..bf181713e7 100644 --- a/src/core/index.rs +++ b/src/core/index.rs @@ -781,24 +781,24 @@ mod tests { for i in 0u64..8_000u64 { writer.add_document(doc!(field => i))?; } - let (sender, receiver) = crossbeam::channel::unbounded(); - let _handle = directory.watch(WatchCallback::new(move || { - let _ = sender.send(()); - })); + writer.commit()?; let mem_right_after_commit = directory.total_mem_usage(); - assert!(receiver.recv().is_ok()); + let reader = index .reader_builder() .reload_policy(ReloadPolicy::Manual) .try_into()?; - assert_eq!(reader.searcher().num_docs(), 8_000); + assert_eq!(reader.searcher().segment_readers().len(), 8); + writer.wait_merging_threads()?; + let mem_right_after_merge_finished = directory.total_mem_usage(); reader.reload().unwrap(); let searcher = reader.searcher(); + assert_eq!(searcher.segment_readers().len(), 1); assert_eq!(searcher.num_docs(), 8_000); assert!( mem_right_after_merge_finished < mem_right_after_commit, diff --git a/src/future_result.rs b/src/future_result.rs index b3c66cae4e..d1d43f7e28 100644 --- a/src/future_result.rs +++ b/src/future_result.rs @@ -105,6 +105,7 @@ mod tests { } #[test] + fn test_scheduled_result_error() { let (scheduled_result, tx): (FutureResult<()>, _) = FutureResult::create("failed"); drop(tx); diff --git a/src/indexer/segment_updater.rs b/src/indexer/segment_updater.rs index 61d98412ef..9b51440fb4 100644 --- a/src/indexer/segment_updater.rs +++ b/src/indexer/segment_updater.rs @@ -539,17 +539,17 @@ impl SegmentUpdater { merge_operation.target_opstamp(), ) { Ok(after_merge_segment_entry) => { - let segment_meta = + let segment_meta_res = segment_updater.end_merge(merge_operation, after_merge_segment_entry); - let _send_result = merging_future_send.send(segment_meta); + let _send_result = merging_future_send.send(segment_meta_res); } - Err(e) => { + Err(merge_error) => { warn!( "Merge of {:?} was cancelled: {:?}", merge_operation.segment_ids().to_vec(), - e + merge_error ); - // ... cancel merge + let _send_result = merging_future_send.send(Err(merge_error)); assert!(!cfg!(test), "Merge failed."); } } diff --git a/src/tokenizer/ascii_folding_filter.rs b/src/tokenizer/ascii_folding_filter.rs index 56b4dfac77..21103e7776 100644 --- a/src/tokenizer/ascii_folding_filter.rs +++ b/src/tokenizer/ascii_folding_filter.rs @@ -1625,9 +1625,9 @@ mod tests { #[test] fn test_to_ascii() { - let mut input = "Rámon".to_string(); + let input = "Rámon".to_string(); let mut buffer = String::new(); - to_ascii(&mut input, &mut buffer); + to_ascii(&input, &mut buffer); assert_eq!("Ramon", buffer); }