Apache Solr open-source search software
LUCENE-6002: Fix monster tests so they pass.
Shawn Heisey3a9b98e64a49
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex b05028e188e..98ac77f99e9 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -198,6 +198,12 @@ Testsindex files to use Version.toString() in filename.(Ryan Ernst)+* LUCENE-6002: Monster tests no longer fail. Most of them now have an 80 hour+ timeout, effectively removing the timeout. The tests that operate near the 2+ billion limit now use IndexWriter.MAX_DOCS instead of Integer.MAX_VALUE.+ Some of the slow Monster tests now explicitly choose the default codec.+ (Mike McCandless, Shawn Heisey)+Optimizations* LUCENE-5960: Use a more efficient bitset, not a Set<Integer>, todiff --git a/lucene/core/src/test/org/apache/lucene/index/Test2BBinaryDocValues.java b/lucene/core/src/test/org/apache/lucene/index/Test2BBinaryDocValues.javaindex de8b2c74ca8..d41e575eacf 100644--- a/lucene/core/src/test/org/apache/lucene/index/Test2BBinaryDocValues.java+++ b/lucene/core/src/test/org/apache/lucene/index/Test2BBinaryDocValues.java@@ -28,13 +28,16 @@ import org.apache.lucene.util.BytesRef;import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.LuceneTestCase.Monster;import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;+import org.apache.lucene.util.TestUtil;import org.apache.lucene.util.TimeUnits;import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;@SuppressCodecs({"SimpleText", "Memory", "Direct"})-@TimeoutSuite(millis = 80 * TimeUnits.HOUR)-@Monster("takes ~ 45 minutes")+@TimeoutSuite(millis = 80 * TimeUnits.HOUR) // effectively no limit+// The six hour time was achieved on a Linux 3.13 system with these specs:+// 3-core AMD at 2.5Ghz, 12 GB RAM, 5GB test heap, 2 test JVMs, 2TB SATA.+@Monster("takes ~ 6 hours if the heap is 5gb")public class Test2BBinaryDocValues extends LuceneTestCase {// indexes IndexWriter.MAX_DOCS docs with a fixed binary field@@ -50,7 +53,8 @@ public class Test2BBinaryDocValues extends LuceneTestCase {.setRAMBufferSizeMB(256.0).setMergeScheduler(new ConcurrentMergeScheduler()).setMergePolicy(newLogMergePolicy(false, 10))- .setOpenMode(IndexWriterConfig.OpenMode.CREATE));+ .setOpenMode(IndexWriterConfig.OpenMode.CREATE)+ .setCodec(TestUtil.getDefaultCodec()));Document doc = new Document();byte bytes[] = new byte[4];@@ -109,7 +113,8 @@ public class Test2BBinaryDocValues extends LuceneTestCase {.setRAMBufferSizeMB(256.0).setMergeScheduler(new ConcurrentMergeScheduler()).setMergePolicy(newLogMergePolicy(false, 10))- .setOpenMode(IndexWriterConfig.OpenMode.CREATE));+ .setOpenMode(IndexWriterConfig.OpenMode.CREATE)+ .setCodec(TestUtil.getDefaultCodec()));Document doc = new Document();byte bytes[] = new byte[4];diff --git a/lucene/core/src/test/org/apache/lucene/index/Test2BNumericDocValues.java b/lucene/core/src/test/org/apache/lucene/index/Test2BNumericDocValues.javaindex a4d9e3719b0..081f4352e9c 100644--- a/lucene/core/src/test/org/apache/lucene/index/Test2BNumericDocValues.java+++ b/lucene/core/src/test/org/apache/lucene/index/Test2BNumericDocValues.java@@ -23,6 +23,7 @@ import org.apache.lucene.document.NumericDocValuesField;import org.apache.lucene.store.BaseDirectoryWrapper;import org.apache.lucene.store.MockDirectoryWrapper;import org.apache.lucene.util.LuceneTestCase;+import org.apache.lucene.util.TestUtil;import org.apache.lucene.util.TimeUnits;import org.apache.lucene.util.LuceneTestCase.Monster;import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;@@ -30,8 +31,10 @@ import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;@SuppressCodecs({"SimpleText", "Memory", "Direct"})-@TimeoutSuite(millis = 80 * TimeUnits.HOUR)-@Monster("takes ~ 30 minutes")+@TimeoutSuite(millis = 8 * TimeUnits.HOUR)+// The two hour time was achieved on a Linux 3.13 system with these specs:+// 3-core AMD at 2.5Ghz, 12 GB RAM, 5GB test heap, 2 test JVMs, 2TB SATA.+@Monster("takes ~ 2 hours if the heap is 5gb")public class Test2BNumericDocValues extends LuceneTestCase {// indexes IndexWriter.MAX_DOCS docs with an increasing dv field@@ -47,7 +50,8 @@ public class Test2BNumericDocValues extends LuceneTestCase {.setRAMBufferSizeMB(256.0).setMergeScheduler(new ConcurrentMergeScheduler()).setMergePolicy(newLogMergePolicy(false, 10))- .setOpenMode(IndexWriterConfig.OpenMode.CREATE));+ .setOpenMode(IndexWriterConfig.OpenMode.CREATE)+ .setCodec(TestUtil.getDefaultCodec()));Document doc = new Document();NumericDocValuesField dvField = new NumericDocValuesField("dv", 0);diff --git a/lucene/core/src/test/org/apache/lucene/index/Test2BPositions.java b/lucene/core/src/test/org/apache/lucene/index/Test2BPositions.javaindex 98dbaa57dcb..6036de37550 100644--- a/lucene/core/src/test/org/apache/lucene/index/Test2BPositions.java+++ b/lucene/core/src/test/org/apache/lucene/index/Test2BPositions.java@@ -28,6 +28,7 @@ import org.apache.lucene.document.TextField;import org.apache.lucene.store.BaseDirectoryWrapper;import org.apache.lucene.store.MockDirectoryWrapper;import org.apache.lucene.util.LuceneTestCase;+import org.apache.lucene.util.TestUtil;import org.apache.lucene.util.TimeUnits;import org.apache.lucene.util.LuceneTestCase.Monster;import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;@@ -39,7 +40,6 @@ import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;* @lucene.experimental*/@SuppressCodecs({ "SimpleText", "Memory", "Direct" })-@TimeoutSuite(millis = 4 * TimeUnits.HOUR)@Monster("uses lots of space and takes a few minutes")public class Test2BPositions extends LuceneTestCase {@@ -55,7 +55,8 @@ public class Test2BPositions extends LuceneTestCase {.setRAMBufferSizeMB(256.0).setMergeScheduler(new ConcurrentMergeScheduler()).setMergePolicy(newLogMergePolicy(false, 10))- .setOpenMode(IndexWriterConfig.OpenMode.CREATE));+ .setOpenMode(IndexWriterConfig.OpenMode.CREATE)+ .setCodec(TestUtil.getDefaultCodec()));MergePolicy mp = w.getConfig().getMergePolicy();if (mp instanceof LogByteSizeMergePolicy) {diff --git a/lucene/core/src/test/org/apache/lucene/index/Test2BPostingsBytes.java b/lucene/core/src/test/org/apache/lucene/index/Test2BPostingsBytes.javaindex a6b1d60bbe7..7252c16bb17 100644--- a/lucene/core/src/test/org/apache/lucene/index/Test2BPostingsBytes.java+++ b/lucene/core/src/test/org/apache/lucene/index/Test2BPostingsBytes.java@@ -30,6 +30,7 @@ import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.store.BaseDirectoryWrapper;import org.apache.lucene.store.MockDirectoryWrapper;import org.apache.lucene.util.LuceneTestCase;+import org.apache.lucene.util.TestUtil;import org.apache.lucene.util.TimeUnits;import org.apache.lucene.util.LuceneTestCase.Monster;import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;@@ -42,7 +43,6 @@ import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;* @lucene.experimental*/@SuppressCodecs({ "SimpleText", "Memory", "Direct" })-@TimeoutSuite(millis = 4 * TimeUnits.HOUR)@Monster("takes ~20GB-30GB of space and 10 minutes, and more heap space sometimes")public class Test2BPostingsBytes extends LuceneTestCase {@@ -58,7 +58,8 @@ public class Test2BPostingsBytes extends LuceneTestCase {.setRAMBufferSizeMB(256.0).setMergeScheduler(new ConcurrentMergeScheduler()).setMergePolicy(newLogMergePolicy(false, 10))- .setOpenMode(IndexWriterConfig.OpenMode.CREATE));+ .setOpenMode(IndexWriterConfig.OpenMode.CREATE)+ .setCodec(TestUtil.getDefaultCodec()));MergePolicy mp = w.getConfig().getMergePolicy();if (mp instanceof LogByteSizeMergePolicy) {diff --git a/lucene/core/src/test/org/apache/lucene/index/Test2BSortedDocValues.java b/lucene/core/src/test/org/apache/lucene/index/Test2BSortedDocValues.javaindex bea1581ac18..fd787050cd8 100644--- a/lucene/core/src/test/org/apache/lucene/index/Test2BSortedDocValues.java+++ b/lucene/core/src/test/org/apache/lucene/index/Test2BSortedDocValues.java@@ -24,6 +24,7 @@ import org.apache.lucene.store.BaseDirectoryWrapper;import org.apache.lucene.store.MockDirectoryWrapper;import org.apache.lucene.util.BytesRef;import org.apache.lucene.util.LuceneTestCase;+import org.apache.lucene.util.TestUtil;import org.apache.lucene.util.TimeUnits;import org.apache.lucene.util.LuceneTestCase.Monster;import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;@@ -31,8 +32,10 @@ import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;@SuppressCodecs({"SimpleText", "Memory", "Direct"})-@TimeoutSuite(millis = 80 * TimeUnits.HOUR)-@Monster("very slow")+@TimeoutSuite(millis = 80 * TimeUnits.HOUR) // effectively no limit+// The six hour time was achieved on a Linux 3.13 system with these specs:+// 3-core AMD at 2.5Ghz, 12 GB RAM, 5GB test heap, 2 test JVMs, 2TB SATA.+@Monster("Takes ~ 6 hours if the heap is 5gb")public class Test2BSortedDocValues extends LuceneTestCase {// indexes Integer.MAX_VALUE docs with a fixed binary field@@ -48,7 +51,8 @@ public class Test2BSortedDocValues extends LuceneTestCase {.setRAMBufferSizeMB(256.0).setMergeScheduler(new ConcurrentMergeScheduler()).setMergePolicy(newLogMergePolicy(false, 10))- .setOpenMode(IndexWriterConfig.OpenMode.CREATE));+ .setOpenMode(IndexWriterConfig.OpenMode.CREATE)+ .setCodec(TestUtil.getDefaultCodec()));Document doc = new Document();byte bytes[] = new byte[2];@@ -103,7 +107,8 @@ public class Test2BSortedDocValues extends LuceneTestCase {.setRAMBufferSizeMB(256.0).setMergeScheduler(new ConcurrentMergeScheduler()).setMergePolicy(newLogMergePolicy(false, 10))- .setOpenMode(IndexWriterConfig.OpenMode.CREATE));+ .setOpenMode(IndexWriterConfig.OpenMode.CREATE)+ .setCodec(TestUtil.getDefaultCodec()));Document doc = new Document();byte bytes[] = new byte[4];diff --git a/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java b/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.javaindex 3cb906f7a5f..a0a84dfd4cd 100644--- a/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java+++ b/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java@@ -55,9 +55,8 @@ import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;// ant test -Dtests.monster=true -Dtests.heapsize=8g -Dtests.codec=Lucene50 -Dtestcase=Test2BTerms//@SuppressCodecs({ "SimpleText", "Memory", "Direct" })-@Monster("very slow, use 8g heap")-@TimeoutSuite(millis = 6 * TimeUnits.HOUR)-@SuppressSysoutChecks(bugUrl="We.print.lots.o.stuff.on.purpose")+@Monster("very slow, use 5g minimum heap")+@TimeoutSuite(millis = 80 * TimeUnits.HOUR) // effectively no limitpublic class Test2BTerms extends LuceneTestCase {private final static int TOKEN_LEN = 5;@@ -185,7 +184,8 @@ public class Test2BTerms extends LuceneTestCase {.setRAMBufferSizeMB(256.0).setMergeScheduler(new ConcurrentMergeScheduler()).setMergePolicy(newLogMergePolicy(false, 10))- .setOpenMode(IndexWriterConfig.OpenMode.CREATE));+ .setOpenMode(IndexWriterConfig.OpenMode.CREATE)+ .setCodec(TestUtil.getDefaultCodec()));MergePolicy mp = w.getConfig().getMergePolicy();if (mp instanceof LogByteSizeMergePolicy) {diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterMaxDocs.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterMaxDocs.javaindex c69540baf48..4604c5310e9 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterMaxDocs.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterMaxDocs.java@@ -34,10 +34,12 @@ import org.apache.lucene.util.TimeUnits;import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;@SuppressCodecs({ "SimpleText", "Memory", "Direct" })-@TimeoutSuite(millis = 6 * TimeUnits.HOUR)+@TimeoutSuite(millis = 8 * TimeUnits.HOUR)public class TestIndexWriterMaxDocs extends LuceneTestCase {- @Monster("takes a long time")+ // The two hour time was achieved on a Linux 3.13 system with these specs:+ // 3-core AMD at 2.5Ghz, 12 GB RAM, 5GB test heap, 2 test JVMs, 2TB SATA.+ @Monster("takes over two hours")public void testExactlyAtTrueLimit() throws Exception {Directory dir = newFSDirectory(createTempDir("2BDocs3"));IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(null));diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleLimitSysouts.java b/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleLimitSysouts.javaindex 5885d823363..b3e783ec4c9 100644--- a/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleLimitSysouts.java+++ b/lucene/test-framework/src/java/org/apache/lucene/util/TestRuleLimitSysouts.java@@ -16,6 +16,7 @@ import java.util.List;import java.util.Locale;import java.util.concurrent.atomic.AtomicInteger;+import org.apache.lucene.util.LuceneTestCase.Monster;import org.apache.lucene.util.LuceneTestCase.SuppressSysoutChecks;import com.carrotsearch.randomizedtesting.RandomizedTest;@@ -180,6 +181,7 @@ public class TestRuleLimitSysouts extends TestRuleAdapter {if (LuceneTestCase.VERBOSE ||LuceneTestCase.INFOSTREAM ||+ target.isAnnotationPresent(Monster.class) ||target.isAnnotationPresent(SuppressSysoutChecks.class)) {return false;}