fix test to use IW not RIW; add verbosity when LTC changes live IWC settings

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1593405 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2014-05-08 20:13:34 +00:00
parent 2286f803eb
commit e1275cd041
2 changed files with 14 additions and 2 deletions

View File

@ -356,7 +356,7 @@ public class TestConcurrentMergeScheduler extends LuceneTestCase {
// no
iwc.setCodec(TestUtil.alwaysPostingsFormat(new Lucene41PostingsFormat()));
}
RandomIndexWriter w = new RandomIndexWriter(random(), d, iwc);
IndexWriter w = new IndexWriter(d, iwc);
for(int i=0;i<1000;i++) {
Document doc = new Document();
doc.add(new StringField("id", ""+i, Field.Store.NO));
@ -366,7 +366,7 @@ public class TestConcurrentMergeScheduler extends LuceneTestCase {
w.deleteDocuments(new Term("id", ""+random().nextInt(i+1)));
}
}
assertTrue(((TrackingCMS) w.w.getConfig().getMergeScheduler()).totMergedBytes != 0);
assertTrue(((TrackingCMS) w.getConfig().getMergeScheduler()).totMergedBytes != 0);
w.shutdown();
d.close();
}

View File

@ -1035,6 +1035,8 @@ public abstract class LuceneTestCase extends Assert {
// if you want it in LiveIndexWriterConfig: it must and will be tested here.
public static void maybeChangeLiveIndexWriterConfig(Random r, LiveIndexWriterConfig c) {
boolean didChange = false;
if (rarely(r)) {
// change flush parameters:
// this is complicated because the api requires you "invoke setters in a magical order!"
@ -1052,6 +1054,7 @@ public abstract class LuceneTestCase extends Assert {
}
c.setRAMBufferSizeMB(IndexWriterConfig.DISABLE_AUTO_FLUSH);
}
didChange = true;
}
if (rarely(r)) {
@ -1062,6 +1065,7 @@ public abstract class LuceneTestCase extends Assert {
} else {
c.setMaxBufferedDeleteTerms(IndexWriterConfig.DISABLE_AUTO_FLUSH);
}
didChange = true;
}
if (rarely(r)) {
@ -1071,16 +1075,19 @@ public abstract class LuceneTestCase extends Assert {
} else {
c.setMergedSegmentWarmer(null);
}
didChange = true;
}
if (rarely(r)) {
// change CFS flush parameters
c.setUseCompoundFile(r.nextBoolean());
didChange = true;
}
if (rarely(r)) {
// change merge integrity check parameters
c.setCheckIntegrityAtMerge(r.nextBoolean());
didChange = true;
}
if (rarely(r)) {
@ -1091,6 +1098,7 @@ public abstract class LuceneTestCase extends Assert {
int maxMergeCount = TestUtil.nextInt(r, maxThreadCount, maxThreadCount + 4);
((ConcurrentMergeScheduler)ms).setMaxMergesAndThreads(maxMergeCount, maxThreadCount);
}
didChange = true;
}
if (rarely(r)) {
@ -1128,6 +1136,10 @@ public abstract class LuceneTestCase extends Assert {
configureRandom(r, tmp);
tmp.setReclaimDeletesWeight(r.nextDouble()*4);
}
didChange = true;
}
if (VERBOSE && didChange) {
System.out.println("NOTE: LuceneTestCase: randomly changed IWC's live settings to:\n" + c);
}
}