invoke cms parameters randomly

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1593393 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2014-05-08 19:43:29 +00:00
parent b943e47c99
commit 1b0834ec83
1 changed files with 12 additions and 1 deletions

View File

@ -84,6 +84,7 @@ import org.apache.lucene.index.LogByteSizeMergePolicy;
import org.apache.lucene.index.LogDocMergePolicy;
import org.apache.lucene.index.LogMergePolicy;
import org.apache.lucene.index.MergePolicy;
import org.apache.lucene.index.MergeScheduler;
import org.apache.lucene.index.MockRandomMergePolicy;
import org.apache.lucene.index.MultiDocValues;
import org.apache.lucene.index.MultiFields;
@ -1082,7 +1083,17 @@ public abstract class LuceneTestCase extends Assert {
c.setCheckIntegrityAtMerge(r.nextBoolean());
}
// TODO: mergepolicy, mergescheduler, etc have mutable state on indexwriter
if (rarely(r)) {
// change CMS merge parameters
MergeScheduler ms = c.getMergeScheduler();
if (ms instanceof ConcurrentMergeScheduler) {
int maxThreadCount = TestUtil.nextInt(random(), 1, 4);
int maxMergeCount = TestUtil.nextInt(random(), maxThreadCount, maxThreadCount + 4);
((ConcurrentMergeScheduler)ms).setMaxMergesAndThreads(maxMergeCount, maxThreadCount);
}
}
// TODO: mergepolicy, etc have mutable state on indexwriter
// every setter must be tested
}