Skip to content

Promote shadow replica to primary when initializing primary fails#22021

Merged
ywelsch merged 2 commits intoelastic:masterfrom
ywelsch:fix/promote-shadow-replica-to-primary-when-initiaizing-primary-fails
Dec 7, 2016
Merged

Promote shadow replica to primary when initializing primary fails#22021
ywelsch merged 2 commits intoelastic:masterfrom
ywelsch:fix/promote-shadow-replica-to-primary-when-initiaizing-primary-fails

Conversation

@ywelsch
Copy link
Copy Markdown
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
Copy Markdown
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.


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
Copy Markdown
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
Copy Markdown
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. Please avoid if you can. 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. Please avoid if you can. 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