Skip to content

Prefer nodes that previously held primary shard for primary shard allocation #16096

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 1 commit into from
Jan 20, 2016

Conversation

ywelsch
Copy link
Contributor

@ywelsch ywelsch commented Jan 19, 2016

Allocation ids are currently used during primary shard allocation to decide which nodes have non-stale copies of the shard data. Instead of just having a set of allocation ids representing the shard copies that have been last active, we can order this set by putting allocation ids of active primaries first. This allows the primary shard allocator to prefer allocation on nodes that previously held the active primary shard.

Relates to #14739

@bleskes
Copy link
Contributor

bleskes commented Jan 19, 2016

Thanks @ywelsch . I was originally thinking of a simpler approach (at least, I think so) - extend NodeGatewayStartedShards to include the primary flag, which we store and use that. This means the change is limited to PrimaryShardAllocator. I like the simplicity of having a Set of active allocation ID, no preference, no ordering.

@ywelsch
Copy link
Contributor Author

ywelsch commented Jan 20, 2016

My concern for relying on ShardStateMetaData is that it can be out-of-sync with cluster state. I agree though that for this specific use case (which is just a soft preference) perfect synchrony does not matter and that your approach better scopes the change.

@ywelsch ywelsch force-pushed the feature/prefer-previous-primary branch from 3218bf9 to 1eb8d5b Compare January 20, 2016 10:02
@ywelsch
Copy link
Contributor Author

ywelsch commented Jan 20, 2016

@bleskes I updated the PR. can you have a look?

@bleskes
Copy link
Contributor

bleskes commented Jan 20, 2016

LGTM. Love the stats +81 -47 (most of it is tests).

ywelsch pushed a commit that referenced this pull request Jan 20, 2016
Prefer nodes that previously held primary shard for primary shard allocation
@ywelsch ywelsch merged commit 303b430 into elastic:master Jan 20, 2016
@lcawl lcawl added :Distributed Indexing/Distributed A catch all label for anything in the Distributed Indexing Area. Please avoid if you can. and removed :Allocation labels Feb 13, 2018
@clintongormley clintongormley added :Distributed Coordination/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) and removed :Distributed Indexing/Distributed A catch all label for anything in the Distributed Indexing Area. Please avoid if you can. labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Coordination/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) >enhancement v5.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants