Skip to content

Commit d6ce8a1

Browse files
committed
Apply feedback
1 parent 2b3f51f commit d6ce8a1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

server/src/main/java/org/elasticsearch/index/engine/ReadOnlyEngine.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,17 @@ public ReadOnlyEngine(EngineConfig config, SeqNoStats seqNoStats, TranslogStats
101101
this.translogStats = translogStats == null ? new TranslogStats(0, 0, 0, 0, 0) : translogStats;
102102
if (seqNoStats == null) {
103103
seqNoStats = buildSeqNoStats(lastCommittedSegmentInfos);
104-
// the global checkpoint is not always known and up to date when the engine is created,
105-
// so we only check the max seq no / global checkpoint coherency when the global checkpoint
106-
// is different from the unassigned sequence number value. In addition to that we only execute
107-
// the check if the index the engine belongs to has been created after the refactoring of the
108-
// Close Index API and its TransportVerifyShardBeforeCloseAction that guarantee that all
109-
// operations have been flushed to Lucene.
104+
// During a peer-recovery the global checkpoint is not known and up to date when the engine
105+
// is created, so we only check the max seq no / global checkpoint coherency when the global
106+
// checkpoint is different from the unassigned sequence number value.
107+
// In addition to that we only execute the check if the index the engine belongs to has been
108+
// created after the refactoring of the Close Index API and its TransportVerifyShardBeforeCloseAction
109+
// that guarantee that all operations have been flushed to Lucene.
110110
final long globalCheckpoint = engineConfig.getGlobalCheckpointSupplier().getAsLong();
111111
if (globalCheckpoint != SequenceNumbers.UNASSIGNED_SEQ_NO
112112
&& engineConfig.getIndexSettings().getIndexVersionCreated().onOrAfter(Version.V_6_7_0)) {
113113
if (seqNoStats.getMaxSeqNo() != globalCheckpoint) {
114+
assert false : "max seq. no. [" + seqNoStats.getMaxSeqNo() + "] does not match [" + globalCheckpoint + "]";
114115
throw new IllegalStateException("Maximum sequence number [" + seqNoStats.getMaxSeqNo()
115116
+ "] from last commit does not match global checkpoint [" + globalCheckpoint + "]");
116117
}

0 commit comments

Comments
 (0)