mirror of https://github.com/apache/lucene.git
LUCENE-9440: call FieldInfo.checkConsistency for real (not under assert)
This commit is contained in:
parent
d894a7e8d7
commit
cb457571e8
|
@ -178,6 +178,9 @@ Improvements
|
|||
* LUCENE-9416: Fix CheckIndex to print an invalid non-zero norm as
|
||||
unsigned long when detecting corruption.
|
||||
|
||||
* LUCENE-9440: FieldInfo#checkConsistency called twice from Lucene50(60)FieldInfosFormat#read;
|
||||
Removed the (redundant?) assert and do these checks for real. (Yauheni Putsykovich)
|
||||
|
||||
Optimizations
|
||||
---------------------
|
||||
|
||||
|
|
|
@ -149,7 +149,6 @@ public final class Lucene50FieldInfosFormat extends FieldInfosFormat {
|
|||
try {
|
||||
infos[i] = new FieldInfo(name, fieldNumber, storeTermVector, omitNorms, storePayloads,
|
||||
indexOptions, docValuesType, dvGen, attributes, 0, 0, 0, false);
|
||||
infos[i].checkConsistency();
|
||||
} catch (IllegalStateException e) {
|
||||
throw new CorruptIndexException("invalid fieldinfo for field: " + name + ", fieldNumber=" + fieldNumber, input, e);
|
||||
}
|
||||
|
|
|
@ -165,7 +165,6 @@ public final class Lucene60FieldInfosFormat extends FieldInfosFormat {
|
|||
infos[i] = new FieldInfo(name, fieldNumber, storeTermVector, omitNorms, storePayloads,
|
||||
indexOptions, docValuesType, dvGen, attributes,
|
||||
pointDataDimensionCount, pointIndexDimensionCount, pointNumBytes, isSoftDeletesField);
|
||||
infos[i].checkConsistency();
|
||||
} catch (IllegalStateException e) {
|
||||
throw new CorruptIndexException("invalid fieldinfo for field: " + name + ", fieldNumber=" + fieldNumber, input, e);
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ public final class FieldInfo {
|
|||
this.pointIndexDimensionCount = pointIndexDimensionCount;
|
||||
this.pointNumBytes = pointNumBytes;
|
||||
this.softDeletesField = softDeletesField;
|
||||
assert checkConsistency();
|
||||
this.checkConsistency();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -179,7 +179,7 @@ public final class FieldInfo {
|
|||
if (attributes != null) {
|
||||
this.attributes.putAll(attributes);
|
||||
}
|
||||
assert checkConsistency();
|
||||
this.checkConsistency();
|
||||
}
|
||||
|
||||
/** Record that this field is indexed with points, with the
|
||||
|
@ -214,7 +214,7 @@ public final class FieldInfo {
|
|||
pointIndexDimensionCount = indexDimensionCount;
|
||||
pointNumBytes = numBytes;
|
||||
|
||||
assert checkConsistency();
|
||||
this.checkConsistency();
|
||||
}
|
||||
|
||||
/** Return point data dimension count */
|
||||
|
@ -241,7 +241,7 @@ public final class FieldInfo {
|
|||
throw new IllegalArgumentException("cannot change DocValues type from " + docValuesType + " to " + type + " for field \"" + name + "\"");
|
||||
}
|
||||
docValuesType = type;
|
||||
assert checkConsistency();
|
||||
this.checkConsistency();
|
||||
}
|
||||
|
||||
/** Returns IndexOptions for the field, or IndexOptions.NONE if the field is not indexed */
|
||||
|
@ -263,6 +263,7 @@ public final class FieldInfo {
|
|||
// cannot store payloads if we don't store positions:
|
||||
storePayloads = false;
|
||||
}
|
||||
this.checkConsistency();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -276,7 +277,7 @@ public final class FieldInfo {
|
|||
/** Sets the docValues generation of this field. */
|
||||
void setDocValuesGen(long dvGen) {
|
||||
this.dvGen = dvGen;
|
||||
assert checkConsistency();
|
||||
this.checkConsistency();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -289,14 +290,14 @@ public final class FieldInfo {
|
|||
|
||||
void setStoreTermVectors() {
|
||||
storeTermVector = true;
|
||||
assert checkConsistency();
|
||||
this.checkConsistency();
|
||||
}
|
||||
|
||||
void setStorePayloads() {
|
||||
if (indexOptions != IndexOptions.NONE && indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0) {
|
||||
storePayloads = true;
|
||||
}
|
||||
assert checkConsistency();
|
||||
this.checkConsistency();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -312,6 +313,7 @@ public final class FieldInfo {
|
|||
throw new IllegalStateException("cannot omit norms: this field is not indexed");
|
||||
}
|
||||
omitNorms = true;
|
||||
this.checkConsistency();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue