zacharymorn commented on a change in pull request #2342:
URL: https://github.com/apache/lucene-solr/pull/2342#discussion_r574958684



##########
File path: lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
##########
@@ -3518,15 +3518,30 @@ private long prepareCommitInternal() throws IOException 
{
       }
 
       if (pointInTimeMerges != null) {
+        MergePolicy.OneMerge nextMerge = null;
+
+        if (pendingMerges.size() > 0) {
+          // nocommit getting OneMerge instance here via 
mergeSource.getNextMerge() will

Review comment:
       No problem! From the context I assume you are actually meaning to pass 
`pointInTimeMerges` into event listener, since `pendingMerges` is of type 
`Deque<MergePolicy.OneMerge>`? I've pushed a commit to use `pointInTimeMerges` 
for now.

##########
File path: 
lucene/core/src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java
##########
@@ -388,6 +388,69 @@ public void testMergeOnCommit() throws IOException {
     dir.close();
   }
 
+  private class TesIndexWriterEventListener implements 
IndexWriterEventListener {
+    private boolean beginMergeCalled = false;
+    private boolean endMergeCalled = false;
+
+    @Override
+    public void beginMergeOnFullFlush(MergePolicy.OneMerge merge) {
+      beginMergeCalled = true;
+    }
+
+    @Override
+    public void endMergeOnFullFlush(MergePolicy.OneMerge merge) {
+      endMergeCalled = true;
+    }
+
+    public boolean isEventsRecorded() {
+      return beginMergeCalled && endMergeCalled;
+    }
+  }
+
+  // Test basic semantics of merge on commit and events recording invocation
+  public void testMergeOnCommitWithEventListener() throws IOException {

Review comment:
       Makes sense. Added.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to