mirror of https://github.com/apache/lucene.git
LUCENE-1314: add asserts during *Reader.clone() that the incoming SegmentInfo/s matches the current reader
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@746343 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
36438c1ee7
commit
f8dc3bbd7d
|
@ -106,6 +106,10 @@ class MultiSegmentReader extends DirectoryIndexReader implements Cloneable {
|
||||||
try {
|
try {
|
||||||
SegmentReader newReader;
|
SegmentReader newReader;
|
||||||
if (newReaders[i] == null || infos.info(i).getUseCompoundFile() != newReaders[i].getSegmentInfo().getUseCompoundFile()) {
|
if (newReaders[i] == null || infos.info(i).getUseCompoundFile() != newReaders[i].getSegmentInfo().getUseCompoundFile()) {
|
||||||
|
|
||||||
|
// We should never see a totally new segment during cloning
|
||||||
|
assert !doClone;
|
||||||
|
|
||||||
// this is a new reader; in case we hit an exception we can close it safely
|
// this is a new reader; in case we hit an exception we can close it safely
|
||||||
newReader = SegmentReader.get(readOnly, infos.info(i));
|
newReader = SegmentReader.get(readOnly, infos.info(i));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -671,6 +671,10 @@ class SegmentReader extends DirectoryIndexReader {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When cloning, the incoming SegmentInfos should not
|
||||||
|
// have any changes in it:
|
||||||
|
assert !doClone || (normsUpToDate && deletionsUpToDate);
|
||||||
|
|
||||||
// clone reader
|
// clone reader
|
||||||
SegmentReader clone;
|
SegmentReader clone;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue