dnhatn commented on a change in pull request #1155: LUCENE-8962: Add ability to selectively merge on commit URL: https://github.com/apache/lucene-solr/pull/1155#discussion_r388705514
########## File path: lucene/core/src/java/org/apache/lucene/index/IndexWriter.java ########## @@ -3147,6 +3149,42 @@ public final boolean flushNextBuffer() throws IOException { } } + private MergePolicy.OneMerge updateSegmentInfosOnMergeFinish(MergePolicy.OneMerge merge, final SegmentInfos toCommit, + AtomicReference<CountDownLatch> mergeLatchRef) { + return new MergePolicy.OneMerge(merge.segments) { + public void mergeFinished() throws IOException { + super.mergeFinished(); + CountDownLatch mergeAwaitLatch = mergeLatchRef.get(); + if (mergeAwaitLatch == null) { + // Commit thread timed out waiting for this merge and moved on. No need to manipulate toCommit. Review comment: We need a stronger synchronization to make sure that we won't modify `toCommit` if `commitInternal` has stopped waiting for these merges. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org