Questions about the use of maxSeqNoOfUpdatesOrDeletes in planIndexingAsNonPrimary

Hello. :grinning:

I recently encountered read IOPS high due to translog operation replay during index recovery on a 710 cluster. I want to know more about the logic of this place and have a question about the method planIndexingAsNonPrimary:

When an index request or translog operation perform on replica shard, there are some criteria to avoid querying versionMap or Lucene index about docID one of which is:
if maxSeqNoOfUpdatesOrDeletes <= localCheckpointTracker.getProcessedCheckpoint(), then we can optimizedAppendOnly.

Why we can't just compare maxSeqNoOfUpdatesOrDeletes and index.seqNo()? I see the note in doc is

If {@literal LCP < MSU} then there's a gap: there may be some operations that act on docID(O) about which we do not yet know, so we cannot perform an add.

But maxSeqNoOfUpdatesOrDeletes always the latest from primary. If we just add, will something goes wrong? I didn't think it through so I want to consult you.

Thank you.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.