Skip to content
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

RestoreService should update primary terms when restoring shards of existing indices #38197

Merged
merged 1 commit into from
Feb 1, 2019

Conversation

tlrx
Copy link
Member

@tlrx tlrx commented Feb 1, 2019

Backport of #38177 on 6.x.

…xisting indices (elastic#38177)

When restoring shards of existing indices, the RestoreService also
restores the values of primary terms stored in the snapshot index
metadata. The primary terms are not updated and could potentially
conflict with current index primary terms if the restored primary terms
are lower than the existing ones.

This situation is likely to happen with replicated closed indices
(because primary terms are increased when the index is transitioning
from open to closed state, and the snapshotted primary terms are the
one at the time the index was opened) (see elastic#38024) and maybe also
with CCR.

This commit changes the RestoreService so that it updates the primary
terms using the maximum value between the snapshotted values and
the existing values.

Backport elastic/elasticsearch@da6269b

Related to elastic#33888
@tlrx tlrx added :Distributed Indexing/Distributed A catch all label for anything in the Distributed Area. Please avoid if you can. backport labels Feb 1, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

@tlrx tlrx merged commit 92d4287 into elastic:6.x Feb 1, 2019
@tlrx tlrx deleted the restore-service-and-primary-terms-6.x branch February 5, 2019 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport :Distributed Indexing/Distributed A catch all label for anything in the Distributed Area. Please avoid if you can.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants