You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2013/04/25 21:03:19 UTC

svn commit: r1475905 - /lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java

Author: mikemccand
Date: Thu Apr 25 19:03:19 2013
New Revision: 1475905

URL: http://svn.apache.org/r1475905
Log:
LUCENE-4738: only CheckIndex when the last commit is > segments_1

Modified:
    lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java?rev=1475905&r1=1475904&r2=1475905&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java Thu Apr 25 19:03:19 2013
@@ -138,7 +138,13 @@ public class TestIndexWriterOnJRECrash e
         if (VERBOSE) {
           System.err.println("Checking index: " + file);
         }
-        _TestUtil.checkIndex(dir);
+        // LUCENE-4738: if we crashed while writing first
+        // commit it's possible index will be corrupt (by
+        // design we don't try to be smart about this case
+        // since that too risky):
+        if (SegmentInfos.getLastCommitGeneration(dir) > 1) {
+          _TestUtil.checkIndex(dir);
+        }
         dir.close();
         return true;
       }