mirror of https://github.com/apache/lucene.git
LUCENE-1282: upgrade an assert to a real check, to work around Sun JRE hotspot bug to prevent index corruption
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@655030 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
39651e029d
commit
b591e8c580
|
@ -355,8 +355,15 @@ final class SegmentMerger {
|
|||
fieldsWriter.close();
|
||||
}
|
||||
|
||||
assert 4+docCount*8 == directory.fileLength(segment + "." + IndexFileNames.FIELDS_INDEX_EXTENSION) :
|
||||
"after mergeFields: fdx size mismatch: " + docCount + " docs vs " + directory.fileLength(segment + "." + IndexFileNames.FIELDS_INDEX_EXTENSION) + " length in bytes of " + segment + "." + IndexFileNames.FIELDS_INDEX_EXTENSION;
|
||||
final long fdxFileLength = directory.fileLength(segment + "." + IndexFileNames.FIELDS_INDEX_EXTENSION);
|
||||
|
||||
if (4+docCount*8 != fdxFileLength)
|
||||
// This is most like a bug in Sun JRE 1.6.0_04/_05;
|
||||
// we detect that the bug has struck, here, and
|
||||
// throw an exception to prevent the corruption from
|
||||
// entering the index. See LUCENE-1282 for
|
||||
// details.
|
||||
throw new RuntimeException("mergeFields produced an invalid result: docCount is " + docCount + " but fdx file size is " + fdxFileLength + "; now aborting this merge to prevent index corruption");
|
||||
|
||||
} else
|
||||
// If we are skipping the doc stores, that means there
|
||||
|
|
Loading…
Reference in New Issue