don't use skipInterval 2 for large number of docs

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1395395 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2012-10-07 22:06:33 +00:00
parent c6a0f91a01
commit 1997a9c345
1 changed files with 9 additions and 1 deletions

View File

@ -133,9 +133,17 @@ public final class MockRandomPostingsFormat extends PostingsFormat {
@Override @Override
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException { public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
int minSkipInterval;
if (state.segmentInfo.getDocCount() > 1000000) {
// Test2BPostings can OOME otherwise:
minSkipInterval = 3;
} else {
minSkipInterval = 2;
}
// we pull this before the seed intentionally: because its not consumed at runtime // we pull this before the seed intentionally: because its not consumed at runtime
// (the skipInterval is written into postings header) // (the skipInterval is written into postings header)
int skipInterval = _TestUtil.nextInt(seedRandom, 2, 10); int skipInterval = _TestUtil.nextInt(seedRandom, minSkipInterval, 10);
if (LuceneTestCase.VERBOSE) { if (LuceneTestCase.VERBOSE) {
System.out.println("MockRandomCodec: skipInterval=" + skipInterval); System.out.println("MockRandomCodec: skipInterval=" + skipInterval);