don't let maxMergedSegmentMB be 0.0

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1542234 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2013-11-15 11:18:33 +00:00
parent 8c02d253b2
commit db140ffc83
1 changed files with 8 additions and 0 deletions

View File

@ -1104,6 +1104,14 @@ public class TestIndexWriterReader extends LuceneTestCase {
public void testTooManySegments() throws Exception {
Directory dir = newDirectory();
IndexWriterConfig iwc = newIndexWriterConfig(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()));
}
IndexWriter w = new IndexWriter(dir, iwc);
// Create 500 segments:
for(int i=0;i<500;i++) {