# Questions about the use of maxSeqNoOfUpdatesOrDeletes in planIndexingAsNonPrimary

**URL:** <https://discuss.elastic.co/t/questions-about-the-use-of-maxseqnoofupdatesordeletes-in-planindexingasnonprimary/294650>\
**Category:** Elasticsearch\
**Created:** [January 18, 2022, 3:48am UTC](https://discuss.elastic.co/t/questions-about-the-use-of-maxseqnoofupdatesordeletes-in-planindexingasnonprimary/294650 "2022-01-18T03:48:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![liurui](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/liurui/32/99305_2.png) [@liurui](https://discuss.elastic.co/u/liurui)\
**Post date:** [January 18, 2022, 3:48am UTC](https://discuss.elastic.co/t/questions-about-the-use-of-maxseqnoofupdatesordeletes-in-planindexingasnonprimary/294650/1 "2022-01-18T03:48:14Z")

</div>

Hello. 😀

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`.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/8/e84caf62330d442cf22fd069cd6d130f5f2d7a49.png)

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

```auto
...
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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 15, 2022, 3:48am UTC](https://discuss.elastic.co/t/questions-about-the-use-of-maxseqnoofupdatesordeletes-in-planindexingasnonprimary/294650/2 "2022-02-15T03:48:51Z")

</div>

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