LUCENE-4998: fix a few places to pass IOContext.READONCE instead of IOContext.READ

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1522722 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2013-09-12 20:45:53 +00:00
parent c4eb440bf8
commit ea178175bc
5 changed files with 11 additions and 6 deletions

View File

@ -58,6 +58,11 @@ New Features
String is too restrictive (Robert Muir, Shai Erera, Mike String is too restrictive (Robert Muir, Shai Erera, Mike
McCandless) McCandless)
Bug Fixes
* LUCENE-4998: Fixed a few places to pass IOContext.READONCE instead
of IOContext.READ (Shikhar Bhushan via Mike McCandless)
Changes in backwards compatibility policy Changes in backwards compatibility policy
* LUCENE-5204: Directory doesn't have default implementations for * LUCENE-5204: Directory doesn't have default implementations for

View File

@ -410,7 +410,7 @@ public class CheckIndex {
// note: we only read the format byte (required preamble) here! // note: we only read the format byte (required preamble) here!
IndexInput input = null; IndexInput input = null;
try { try {
input = dir.openInput(segmentsFileName, IOContext.DEFAULT); input = dir.openInput(segmentsFileName, IOContext.READONCE);
} catch (Throwable t) { } catch (Throwable t) {
msg(infoStream, "ERROR: could not open segments file in directory"); msg(infoStream, "ERROR: could not open segments file in directory");
if (infoStream != null) if (infoStream != null)

View File

@ -58,7 +58,7 @@ public final class SegmentReader extends AtomicReader {
try { try {
if (si.hasDeletions()) { if (si.hasDeletions()) {
// NOTE: the bitvector is stored using the regular directory, not cfs // NOTE: the bitvector is stored using the regular directory, not cfs
liveDocs = si.info.getCodec().liveDocsFormat().readLiveDocs(directory(), si, new IOContext(IOContext.READ, true)); liveDocs = si.info.getCodec().liveDocsFormat().readLiveDocs(directory(), si, IOContext.READONCE);
} else { } else {
assert si.getDelCount() == 0; assert si.getDelCount() == 0;
liveDocs = null; liveDocs = null;
@ -80,9 +80,9 @@ public final class SegmentReader extends AtomicReader {
/** Create new SegmentReader sharing core from a previous /** Create new SegmentReader sharing core from a previous
* SegmentReader and loading new live docs from a new * SegmentReader and loading new live docs from a new
* deletes file. Used by openIfChanged. */ * deletes file. Used by openIfChanged. */
SegmentReader(SegmentInfoPerCommit si, SegmentCoreReaders core, IOContext context) throws IOException { SegmentReader(SegmentInfoPerCommit si, SegmentCoreReaders core) throws IOException {
this(si, core, this(si, core,
si.info.getCodec().liveDocsFormat().readLiveDocs(si.info.dir, si, context), si.info.getCodec().liveDocsFormat().readLiveDocs(si.info.dir, si, IOContext.READONCE),
si.info.getDocCount() - si.getDelCount()); si.info.getDocCount() - si.getDelCount());
} }

View File

@ -173,7 +173,7 @@ final class StandardDirectoryReader extends DirectoryReader {
// Steal the ref returned by SegmentReader ctor: // Steal the ref returned by SegmentReader ctor:
assert infos.info(i).info.dir == newReaders[i].getSegmentInfo().info.dir; assert infos.info(i).info.dir == newReaders[i].getSegmentInfo().info.dir;
assert infos.info(i).hasDeletions(); assert infos.info(i).hasDeletions();
newReaders[i] = new SegmentReader(infos.info(i), newReaders[i].core, IOContext.READ); newReaders[i] = new SegmentReader(infos.info(i), newReaders[i].core);
} }
} }
success = true; success = true;

View File

@ -572,7 +572,7 @@ public abstract class BasePostingsFormatTestCase extends LuceneTestCase {
currentFieldInfos = newFieldInfos; currentFieldInfos = newFieldInfos;
SegmentReadState readState = new SegmentReadState(dir, segmentInfo, newFieldInfos, IOContext.DEFAULT); SegmentReadState readState = new SegmentReadState(dir, segmentInfo, newFieldInfos, IOContext.READ);
return codec.postingsFormat().fieldsProducer(readState); return codec.postingsFormat().fieldsProducer(readState);
} }