salvatorecampagna opened a new pull request, #15378:
URL: https://github.com/apache/lucene/pull/15378

   ## Summary
   
   Changes `IndexWriter.forceMergeDeletes()` to return 
`MergePolicy.MergeObserver` instead of void, allowing applications to monitor 
merge progress and wait for completion.
   
   Fixes #14515
   
   ## Motivation
   
   Currently when calling `forceMergeDeletes(false)`, there's no way to monitor 
whether merges were scheduled or wait for them to complete. This makes it 
difficult to coordinate merge completion with other operations or implement 
custom scheduling strategies.
   
   ## Changes
   
   Added `MergePolicy.MergeObserver` as a new public API with methods to:
   - Check merge status (hasNewMerges, numMerges)
   - Wait synchronously with optional timeout
   - Wait asynchronously via CompletableFuture
   - Access individual OneMerge instances
   
   The observer is thread-safe and handles cases where no merges are needed.
   
   Updated `IndexWriter.forceMergeDeletes()` methods to return the observer 
instead of void. Also updated `RandomIndexWriter` to propagate the new return 
type.
   
   ## Testing
   
   Added 7 tests covering blocking and non-blocking modes, timeout handling, 
null spec cases, and bounds checking. All tests passed 500 iterations each with 
no failures.
   
   ## Backward Compatibility
   
   Fully backward compatible. Existing code that ignores the return value 
continues to work unchanged. Changing void to a return type is not a breaking 
change in Java.
   
   ## Files Modified
   
   - MergePolicy.java - New MergeObserver class
   - IndexWriter.java - Updated return types and javadoc  
   - RandomIndexWriter.java - Propagated return type
   - TestIndexWriterMerging.java - New tests
   - CHANGES.txt - Added entry under Improvements


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to