Fix assertion in ReadOnlyEngine (#43010)
We should execute the assertion before throwing an exception; otherwise, it's a noop.
This commit is contained in:
parent
915d2f2daa
commit
afe65b5988
|
@ -141,12 +141,12 @@ public class ReadOnlyEngine extends Engine {
|
|||
final Version indexVersionCreated = engineConfig.getIndexSettings().getIndexVersionCreated();
|
||||
if (indexVersionCreated.onOrAfter(Version.V_7_2_0) ||
|
||||
(seqNoStats.getGlobalCheckpoint() != SequenceNumbers.UNASSIGNED_SEQ_NO && indexVersionCreated.onOrAfter(Version.V_6_7_0))) {
|
||||
assert assertMaxSeqNoEqualsToGlobalCheckpoint(seqNoStats.getMaxSeqNo(), seqNoStats.getGlobalCheckpoint());
|
||||
if (seqNoStats.getMaxSeqNo() != seqNoStats.getGlobalCheckpoint()) {
|
||||
throw new IllegalStateException("Maximum sequence number [" + seqNoStats.getMaxSeqNo()
|
||||
+ "] from last commit does not match global checkpoint [" + seqNoStats.getGlobalCheckpoint() + "]");
|
||||
}
|
||||
}
|
||||
assert assertMaxSeqNoEqualsToGlobalCheckpoint(seqNoStats.getMaxSeqNo(), seqNoStats.getGlobalCheckpoint());
|
||||
}
|
||||
|
||||
protected boolean assertMaxSeqNoEqualsToGlobalCheckpoint(final long maxSeqNo, final long globalCheckpoint) {
|
||||
|
|
Loading…
Reference in New Issue