LUCENE-6297: make sure default LogByteSizeMP.getMaxMergeMBForForcedMerge is > 0.0

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1662325 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2015-02-25 23:24:33 +00:00
parent f2c9067e59
commit f5c7d90d2f
2 changed files with 5 additions and 0 deletions

View File

@ -39,6 +39,7 @@ public class LogByteSizeMergePolicy extends LogMergePolicy {
public LogByteSizeMergePolicy() { public LogByteSizeMergePolicy() {
minMergeSize = (long) (DEFAULT_MIN_MERGE_MB*1024*1024); minMergeSize = (long) (DEFAULT_MIN_MERGE_MB*1024*1024);
maxMergeSize = (long) (DEFAULT_MAX_MERGE_MB*1024*1024); maxMergeSize = (long) (DEFAULT_MAX_MERGE_MB*1024*1024);
// NOTE: in Java, if you cast a too-large double to long, as we are doing here, then it becomes Long.MAX_VALUE
maxMergeSizeForForcedMerge = (long) (DEFAULT_MAX_MERGE_MB_FOR_FORCED_MERGE*1024*1024); maxMergeSizeForForcedMerge = (long) (DEFAULT_MAX_MERGE_MB_FOR_FORCED_MERGE*1024*1024);
} }

View File

@ -23,4 +23,8 @@ public class TestLogMergePolicy extends BaseMergePolicyTestCase {
return newLogMergePolicy(random()); return newLogMergePolicy(random());
} }
public void testDefaultForcedMergeMB() {
LogByteSizeMergePolicy mp = new LogByteSizeMergePolicy();
assertTrue(mp.getMaxMergeMBForForcedMerge() > 0.0);
}
} }