Skip to content

Prevent CCR recovery from missing documents #38472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 9, 2019

Conversation

Tim-Brooks
Copy link
Contributor

Currently the snapshot/restore process manually sets the global
checkpoint to the max sequence number from the restored segements. This
does not work for Ccr as this will lead to documents that would be
recovered in the normal followering operation from being recovered.

This commit fixes this issue by setting the initial global checkpoint to
the existing local checkpoint.

Currently the snapshot/restore process manually sets the global
checkpoint to the max sequence number from the restored segements. This
does not work for Ccr as this will lead to documents that would be
recovered in the normal followering operation from being recovered.

This commit fixes this issue by setting the initial global checkpoint to
the existing local checkpoint.
@Tim-Brooks Tim-Brooks added >non-issue :Distributed Indexing/CCR Issues around the Cross Cluster State Replication features backport v6.7.0 labels Feb 5, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

@jasontedor jasontedor changed the base branch from 6.x to 6.7 February 6, 2019 13:08
@jasontedor jasontedor reopened this Feb 6, 2019
@Tim-Brooks Tim-Brooks added v6.7.0 and removed v7.2.0 labels Feb 8, 2019
@Tim-Brooks Tim-Brooks requested a review from ywelsch February 8, 2019 17:42
@Tim-Brooks
Copy link
Contributor Author

@ywelsch - looks like all of CI passed with the assertions that if local is null, so is max. So do you want to move forward with this?

I can remove the assertions if you think they are unnecessary.

Copy link
Contributor

@ywelsch ywelsch left a comment

Choose a reason for hiding this comment

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

LGTM

final String rawLocalCheckpoint = userData.get(SequenceNumbers.LOCAL_CHECKPOINT_KEY);
final String rawMaxSeqNo = userData.get(SequenceNumbers.MAX_SEQ_NO);
if (rawLocalCheckpoint == null) {
assert rawMaxSeqNo == null : "Local checkpoint null but max sequence number: " + rawMaxSeqNo;
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove the if block and instead write the following 2 assertions:

assert (rawLocalCheckpoint == null) == (rawMaxSeqNo == null) : 
    "local checkpoint was " + rawLocalCheckpoint + " but max seq no was " + rawMaxSeqNo;

assert rawLocalCheckpoint != null || segmentCommitInfos.getCommitLuceneVersion().major < 7 : 
    "Found Lucene version: " + segmentCommitInfos.getCommitLuceneVersion().major;

@Tim-Brooks Tim-Brooks merged commit 1a8d6ff into elastic:6.7 Feb 9, 2019
@Tim-Brooks Tim-Brooks deleted the backport_missing_ops branch December 18, 2019 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport :Distributed Indexing/CCR Issues around the Cross Cluster State Replication features >non-issue v6.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants