Apache Lucene open-source search software
LUCENE-4738: only CheckIndex when the last commit is > segments_1
Michael McCandless614199141f0d
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.javaindex 3852c9907d5..535f9e34730 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java@@ -138,7 +138,13 @@ public class TestIndexWriterOnJRECrash extends TestNRTThreads {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;}