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/05/11 15:47:25 UTC

[lucene-solr] branch branch_8x updated: Fix test to check for close / closing and wait for merge threads to close the writer if concurrency strikes

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 7c9a9dd  Fix test to check for close / closing and wait for merge threads to close the writer if concurrency strikes
7c9a9dd is described below

commit 7c9a9dd85ab3233e075ee5980041c9faa1bcbc52
Author: Simon Willnauer <si...@apache.org>
AuthorDate: Mon May 11 17:46:50 2020 +0200

    Fix test to check for close / closing and wait for merge threads to close the writer if concurrency strikes
---
 .../test/org/apache/lucene/index/TestConcurrentMergeScheduler.java  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lucene/core/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java b/lucene/core/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java
index 050aed7..a31194c 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java
@@ -113,9 +113,13 @@ public class TestConcurrentMergeScheduler extends LuceneTestCase {
             ioe.printStackTrace(System.out);
           }
           failure.clearDoFail();
-          assertTrue(writer.isClosed());
+          // make sure we are closed or closing - if we are unlucky a merge does
+          // the actual closing for us. this is rare but might happen since the
+          // tragicEvent is checked by IFD and that might throw during a merge
+          expectThrows(AlreadyClosedException.class, writer::ensureOpen);
           // Abort should have closed the deleter:
           assertTrue(writer.isDeleterClosed());
+          writer.close(); // now wait for the close to actually happen if a merge thread did the close.
           break outer;
         }
       }