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_r373718101
 
 

 ##########
 File path: lucene/core/src/java/org/apache/lucene/index/MergePolicy.java
 ##########
 @@ -526,6 +526,19 @@ public abstract MergeSpecification findForcedMerges(
   public abstract MergeSpecification findForcedDeletesMerges(
       SegmentInfos segmentInfos, MergeContext mergeContext) throws IOException;
 
+  /**
+   * Identifies merges that we want to execute (synchronously) on commit. By 
default, do not synchronously merge on commit.
+   *
+   * Implementers of this method should use isMergingSegment to exclude any 
already-merging segments from the returned
+   * {@link MergeSpecification}. If a segment already registered in a merge is 
returned, then the commit will fail.
 
 Review comment:
   The code in this PR throws an exception if IW fails to register the merge:
   
   ```
   if (registerMerge(trackedMerge) == false) {
     throw new IllegalStateException("MergePolicy " + 
config.getMergePolicy().getClass() +
         " returned merging segments from findCommitMerges");
   }
   ```
   
   I suppose we could silently disregard the merge if we remember to count down 
the latch for the merge that fails to register. 
   
   What would be less surprising to users? Explosive failure if an invalid 
`MergeSpecification` is returned or letting the commit happen without trying to 
merge? I lean slightly toward explosive failure (with what I hope is a clear 
explanation), but I'm happy to write it either way.

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

Reply via email to