vary readBufferSize in MockRandomCodec

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1101520 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2011-05-10 16:01:17 +00:00
parent 0394a540de
commit 303ff3928f
1 changed files with 12 additions and 3 deletions

View File

@ -140,6 +140,9 @@ public class MockRandomCodec extends Codec {
out.close(); out.close();
final Random random = new Random(seed); final Random random = new Random(seed);
random.nextInt(); // consume a random for buffersize
PostingsWriterBase postingsWriter; PostingsWriterBase postingsWriter;
if (random.nextBoolean()) { if (random.nextBoolean()) {
@ -238,16 +241,22 @@ public class MockRandomCodec extends Codec {
in.close(); in.close();
final Random random = new Random(seed); final Random random = new Random(seed);
int readBufferSize = _TestUtil.nextInt(random, 1, 4096);
if (LuceneTestCase.VERBOSE) {
System.out.println("MockRandomCodec: readBufferSize=" + readBufferSize);
}
PostingsReaderBase postingsReader; PostingsReaderBase postingsReader;
if (random.nextBoolean()) { if (random.nextBoolean()) {
postingsReader = new SepPostingsReaderImpl(state.dir, state.segmentInfo, postingsReader = new SepPostingsReaderImpl(state.dir, state.segmentInfo,
state.readBufferSize, new MockIntStreamFactory(random), state.codecId); readBufferSize, new MockIntStreamFactory(random), state.codecId);
} else { } else {
if (LuceneTestCase.VERBOSE) { if (LuceneTestCase.VERBOSE) {
System.out.println("MockRandomCodec: reading Standard postings"); System.out.println("MockRandomCodec: reading Standard postings");
} }
postingsReader = new StandardPostingsReader(state.dir, state.segmentInfo, state.readBufferSize, state.codecId); postingsReader = new StandardPostingsReader(state.dir, state.segmentInfo, readBufferSize, state.codecId);
} }
if (random.nextBoolean()) { if (random.nextBoolean()) {
@ -312,7 +321,7 @@ public class MockRandomCodec extends Codec {
state.fieldInfos, state.fieldInfos,
state.segmentInfo.name, state.segmentInfo.name,
postingsReader, postingsReader,
state.readBufferSize, readBufferSize,
termsCacheSize, termsCacheSize,
state.codecId); state.codecId);
success = true; success = true;