mirror of https://github.com/apache/lucene.git
LUCENE-6019: add more safety during DV flush
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1633830 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
748fd311e6
commit
ad9fb9a9dd
|
@ -130,6 +130,10 @@ final class DefaultIndexingChain extends DocConsumer {
|
|||
PerField perField = fieldHash[i];
|
||||
while (perField != null) {
|
||||
if (perField.docValuesWriter != null) {
|
||||
if (perField.fieldInfo.hasDocValues() == false) {
|
||||
// BUG
|
||||
throw new AssertionError("segment=" + state.segmentInfo + ": field=\"" + perField.fieldInfo.name + "\" has no docValues but wrote them");
|
||||
}
|
||||
if (dvConsumer == null) {
|
||||
// lazy init
|
||||
DocValuesFormat fmt = state.segmentInfo.getCodec().docValuesFormat();
|
||||
|
@ -139,6 +143,9 @@ final class DefaultIndexingChain extends DocConsumer {
|
|||
perField.docValuesWriter.finish(docCount);
|
||||
perField.docValuesWriter.flush(state, dvConsumer);
|
||||
perField.docValuesWriter = null;
|
||||
} else if (perField.fieldInfo.hasDocValues()) {
|
||||
// BUG
|
||||
throw new AssertionError("segment=" + state.segmentInfo + ": field=\"" + perField.fieldInfo.name + "\" has docValues but did not write them");
|
||||
}
|
||||
perField = perField.next;
|
||||
}
|
||||
|
@ -156,6 +163,16 @@ final class DefaultIndexingChain extends DocConsumer {
|
|||
IOUtils.closeWhileHandlingException(dvConsumer);
|
||||
}
|
||||
}
|
||||
|
||||
if (state.fieldInfos.hasDocValues() == false) {
|
||||
if (dvConsumer != null) {
|
||||
// BUG
|
||||
throw new AssertionError("segment=" + state.segmentInfo + ": fieldInfos has no docValues but wrote them");
|
||||
}
|
||||
} else if (dvConsumer == null) {
|
||||
// BUG
|
||||
throw new AssertionError("segment=" + state.segmentInfo + ": fieldInfos has docValues but did not wrote them");
|
||||
}
|
||||
}
|
||||
|
||||
/** Catch up for all docs before us that had no stored
|
||||
|
|
Loading…
Reference in New Issue