Skip to content

[Test] Add CCR integration tests for pruned sequence numbers#144013

Merged
tlrx merged 5 commits intoelastic:mainfrom
tlrx:2026/03/11-add-ccr-it-seq-no-disabled
Mar 12, 2026
Merged

[Test] Add CCR integration tests for pruned sequence numbers#144013
tlrx merged 5 commits intoelastic:mainfrom
tlrx:2026/03/11-add-ccr-it-seq-no-disabled

Conversation

@tlrx
Copy link
Copy Markdown
Member

@tlrx tlrx commented Mar 11, 2026

This commit adds tests to verify that CCR works correctly with pruned sequence numbers. The test is inspired by SeqNoPruningIT.

Note: made by Cursor, adjusted by me. Also requires #143999 to pass.

Relates #136305

tlrx added 2 commits March 11, 2026 11:17
…nce numbers

The method ESIntegTestCase.getLiveDocs verifies that primary and replica
have the same set of documents. This method must be adapted to account
for sequence numbers that can be merged away on the shard if the
IndexSettings.DISABLE_SEQUENCE_NUMBERS is set.

This method was previously adjusted for synthetic id and synthetic
sources to rely on the Engine's changes snapshot API to retrieve Lucene
documents. At that time, LuceneChangesSnapshot and
LuceneSyntheticSourceChangesSnapshot were changed to accommodate for
missing id/source. It was already a bit ugly but now with _seq_no also
pruned it would require even larger changes in those
Lucene*ChangesSnapshot classes only for testing, since _seq_no are
loaded at the lower level in Lucene*ChangesSnapshot.

So I changed ESIntegTestCase to not use the change snapshot API anymore,
I reverted the changes in Lucene*ChangesSnapshot classes and now simply
bulk load documents from the reader directly.

Relates elastic#136305
This commit adds tests to verify that CCR works correctly with pruned
sequence numbers. The test is inspired by SeqNoPruningIT.

Note: made by Cursor, adjusted by me. Also requires elastic#143999 to pass.

Relates elastic#136305
@tlrx tlrx added >test Issues or PRs that are addressing/adding tests :Distributed/Engine Anything around managing Lucene and the Translog in an open shard. v9.4.0 labels Mar 11, 2026
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Meta label for distributed team. label Mar 11, 2026
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

Copy link
Copy Markdown
Contributor

@romseygeek romseygeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

return client.admin().indices().prepareStats(index).get().getShards()[0].getSeqNoStats().getMaxSeqNo();
}

private void assertLeaderShardsRetainedSeqNoDocValuesCount(String indexName, long expectedCount, int expectedShards) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth having this in SequenceNumbersTestUtils too?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I pushed a032f9a

Copy link
Copy Markdown
Contributor

@fcofdez fcofdez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I left a couple of comments

@tlrx tlrx requested a review from fcofdez March 11, 2026 15:07
Copy link
Copy Markdown
Contributor

@fcofdez fcofdez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tlrx tlrx merged commit 4e84ac5 into elastic:main Mar 12, 2026
26 of 36 checks passed
@tlrx
Copy link
Copy Markdown
Member Author

tlrx commented Mar 12, 2026

Thanks Alan and Francisco!

michalborek pushed a commit to michalborek/elasticsearch that referenced this pull request Mar 23, 2026
…#144013)

This commit adds tests to verify that CCR works correctly with 
pruned sequence numbers. The test is inspired by SeqNoPruningIT.

Relates elastic#136305
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed/Engine Anything around managing Lucene and the Translog in an open shard. Team:Distributed Meta label for distributed team. >test Issues or PRs that are addressing/adding tests v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants