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

Promote shadow replica to primary when initializing primary fails #22021

Conversation

ywelsch
Copy link
Contributor

@ywelsch ywelsch commented Dec 7, 2016

Failing an initializing primary when shadow replicas are enabled for the index can leave the primary unassigned with replicas being active. Instead, a replica should be promoted to primary, which is fixed by this commit.

Test failure:

https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+5.x+multijob-unix-compatibility/os=ubuntu/324/console

Failing an initializing primary when shadow replicas are enabled for the index can leave the primary unassigned with replicas being active. Instead, a replica
should be promoted to primary, which is fixed by this commit.
Copy link
Contributor

@bleskes bleskes left a comment

Choose a reason for hiding this comment

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

LGTM.

@@ -586,6 +592,19 @@ assert node(failedShard.currentNodeId()).getByShardId(failedShard.shardId()) ==
" was matched but wasn't removed";
}

private void promoteReplicaToPrimary(ShardRouting activeReplica, IndexMetaData indexMetaData,
RoutingChangesObserver routingChangesObserver) {
// if the activeReplica was relocating before this call to failShard, its relocation was cancelled above when we
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this comment refers to "above" we should probably reword it or place it somewhere else.

@ywelsch ywelsch merged commit 9630b1a into elastic:master Dec 7, 2016
@ywelsch
Copy link
Contributor Author

ywelsch commented Dec 7, 2016

Thanks @bleskes

ywelsch added a commit that referenced this pull request Dec 7, 2016
…2021)

Failing an initializing primary when shadow replicas are enabled for the index can leave the primary unassigned with replicas being active. Instead, a replica should be promoted to primary, which is fixed by this commit.
ywelsch added a commit that referenced this pull request Dec 7, 2016
…2021)

Failing an initializing primary when shadow replicas are enabled for the index can leave the primary unassigned with replicas being active. Instead, a replica should be promoted to primary, which is fixed by this commit.
@lcawl lcawl added :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. and removed :Allocation labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. v5.1.2 v5.2.0 v6.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants