fix test bug

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1544118 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2013-11-21 11:16:44 +00:00
parent ed723bfaee
commit db8f24dbad
1 changed files with 3 additions and 12 deletions

View File

@ -1103,18 +1103,9 @@ public class TestIndexWriterReader extends LuceneTestCase {
* writer, we don't see merge starvation. */
public void testTooManySegments() throws Exception {
Directory dir = newDirectory();
// Don't use newIndexWriterConfig, because we need a
// "sane" mergePolicy:
IndexWriterConfig iwc = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
MergePolicy mp = iwc.getMergePolicy();
// If we get TieredMP and it's maxMergedSegmentMB is 0
// then this test falsely fails:
if (mp instanceof TieredMergePolicy) {
TieredMergePolicy tmp = (TieredMergePolicy) mp;
tmp.setMaxMergedSegmentMB(Math.max(.01, tmp.getMaxMergedSegmentMB()));
if (tmp.getSegmentsPerTier() > 20) {
tmp.setSegmentsPerTier(20);
}
}
IndexWriter w = new IndexWriter(dir, iwc);
// Create 500 segments:
for(int i=0;i<500;i++) {