lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1702797 - in /lucene/dev/branches/branch_5x: ./ lucene/ lucene/core/ lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java
Date Sun, 13 Sep 2015 17:40:24 GMT
Author: mikemccand
Date: Sun Sep 13 17:40:22 2015
New Revision: 1702797

URL: http://svn.apache.org/r1702797
Log:
LUCENE-6802: fix test bug: if CMS hits tragic exception, writer is already closed

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/lucene/   (props changed)
    lucene/dev/branches/branch_5x/lucene/core/   (props changed)
    lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java

Modified: lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java?rev=1702797&r1=1702796&r2=1702797&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java
Sun Sep 13 17:40:22 2015
@@ -1936,22 +1936,6 @@ public class TestIndexWriterExceptions e
       }
       if (w == null) {
         IndexWriterConfig iwc = newIndexWriterConfig(new MockAnalyzer(random()));
-        final MergeScheduler ms = iwc.getMergeScheduler();
-        if (ms instanceof ConcurrentMergeScheduler) {
-          final ConcurrentMergeScheduler suppressFakeIOE = new ConcurrentMergeScheduler()
{
-              @Override
-              protected void handleMergeException(Directory dir, Throwable exc) {
-                // suppress only FakeIOException:
-                if (!(exc instanceof FakeIOException)) {
-                  super.handleMergeException(dir, exc);
-                }
-              }
-            };
-          final ConcurrentMergeScheduler cms = (ConcurrentMergeScheduler) ms;
-          suppressFakeIOE.setMaxMergesAndThreads(cms.getMaxMergeCount(), cms.getMaxThreadCount());
-          iwc.setMergeScheduler(suppressFakeIOE);
-        }
-        
         w = new RandomIndexWriter(random(), dir, iwc);
         // Since we hit exc during merging, a partial
         // forceMerge can easily return when there are still
@@ -2052,6 +2036,18 @@ public class TestIndexWriterExceptions e
       }
       shouldFail.set(false);
 
+      if (w != null) {
+        MergeScheduler ms = w.w.getConfig().getMergeScheduler();
+        if (ms instanceof ConcurrentMergeScheduler) {
+          ((ConcurrentMergeScheduler) ms).sync();
+        }
+
+        if (w.w.getTragicException() != null) {
+          // Tragic exc in CMS closed the writer
+          w = null;
+        }
+      }
+
       IndexReader r;
 
       if (doClose && w != null) {



Mime
View raw message