You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by si...@apache.org on 2020/06/17 21:29:26 UTC

[lucene-solr] branch branch_8x updated: LUCENE-9408: roll back only called once enforcement

This is an automated email from the ASF dual-hosted git repository.

simonw pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new e3d0c1c  LUCENE-9408: roll back only called once enforcement
e3d0c1c is described below

commit e3d0c1c0e6565d857500d34b9829751e23d9cf68
Author: Simon Willnauer <si...@apache.org>
AuthorDate: Wed Jun 17 23:27:39 2020 +0200

    LUCENE-9408: roll back only called once enforcement
---
 lucene/core/src/java/org/apache/lucene/index/MergePolicy.java | 11 +++++++----
 .../src/test/org/apache/lucene/index/TestMergePolicy.java     |  1 +
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/lucene/core/src/java/org/apache/lucene/index/MergePolicy.java b/lucene/core/src/java/org/apache/lucene/index/MergePolicy.java
index a94e595..1b75dd5 100644
--- a/lucene/core/src/java/org/apache/lucene/index/MergePolicy.java
+++ b/lucene/core/src/java/org/apache/lucene/index/MergePolicy.java
@@ -252,13 +252,16 @@ public abstract class MergePolicy {
     public void mergeInit() throws IOException {
       mergeProgress.setMergeThread(Thread.currentThread());
     }
-    
+
+    private Exception originalClosed;
     /** Called by {@link IndexWriter} after the merge is done and all readers have been closed.
      * @param success true iff the merge finished successfully ie. was committed */
     public void mergeFinished(boolean success) throws IOException {
-      if (mergeCompleted.complete(success) == false) {
-        throw new IllegalStateException("merge has already finished");
-      }
+      mergeCompleted.complete(success);
+      // https://issues.apache.org/jira/browse/LUCENE-9408
+      // if (mergeCompleted.complete(success) == false) {
+      //   throw new IllegalStateException("merge has already finished", originalClosed);
+      // }
     }
 
     /** Wrap the reader in order to add/remove information to the merged segment. */
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestMergePolicy.java b/lucene/core/src/test/org/apache/lucene/index/TestMergePolicy.java
index c252da0..e5f5635 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestMergePolicy.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestMergePolicy.java
@@ -110,6 +110,7 @@ public class TestMergePolicy extends LuceneTestCase {
     }
   }
 
+  @AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/LUCENE-9408")
   public void testFinishTwice() throws IOException {
     try (Directory dir = newDirectory()) {
       MergePolicy.MergeSpecification spec = createRandomMergeSpecification(dir, 1);