Assertion handling timestamp in index request
This commit adds an assertion that the mapping metadata is not null when handling a non-default timestamp when no timestamp is provided. Closes #16596
This commit is contained in:
parent
cca611171c
commit
d313cdd7d0
|
@ -626,6 +626,12 @@ public class IndexRequest extends ReplicationRequest<IndexRequest> implements Do
|
||||||
if (defaultTimestamp.equals(TimestampFieldMapper.Defaults.DEFAULT_TIMESTAMP)) {
|
if (defaultTimestamp.equals(TimestampFieldMapper.Defaults.DEFAULT_TIMESTAMP)) {
|
||||||
timestamp = Long.toString(System.currentTimeMillis());
|
timestamp = Long.toString(System.currentTimeMillis());
|
||||||
} else {
|
} else {
|
||||||
|
// if we are here, the defaultTimestamp is not
|
||||||
|
// TimestampFieldMapper.Defaults.DEFAULT_TIMESTAMP but
|
||||||
|
// this can only happen if defaultTimestamp was
|
||||||
|
// assigned again because mappingMd and
|
||||||
|
// mappingMd#timestamp() are not null
|
||||||
|
assert mappingMd != null;
|
||||||
timestamp = MappingMetaData.Timestamp.parseStringTimestamp(defaultTimestamp, mappingMd.timestamp().dateTimeFormatter(), getVersion(metaData, concreteIndex));
|
timestamp = MappingMetaData.Timestamp.parseStringTimestamp(defaultTimestamp, mappingMd.timestamp().dateTimeFormatter(), getVersion(metaData, concreteIndex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue