msfroh 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_r368184052
 
 

 ##########
 File path: lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
 ##########
 @@ -3223,15 +3259,44 @@ private long prepareCommitInternal() throws 
IOException {
               // sneak into the commit point:
               toCommit = segmentInfos.clone();
 
+              if (anyChanges) {
+                mergeAwaitLatchRef = new AtomicReference<>();
+                MergePolicy mergeOnCommitPolicy = 
waitForMergeOnCommitPolicy(config.getMergePolicy(), toCommit, 
mergeAwaitLatchRef);
+
+                // Find any merges that can execute on commit (per 
MergePolicy).
+                commitMerges = 
mergeOnCommitPolicy.findCommitMerges(segmentInfos, this);
+                if (commitMerges != null && commitMerges.merges.size() > 0) {
 
 Review comment:
   Based on e.g. NoMergePolicy, it looks like the convention to say "I found no 
merges" is to return null, but I can't see anything preventing a MergePolicy 
from returning an empty MergeSpecification.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

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

Reply via email to