Skip to content

Make cluster state external to o.e.c.a.s.ShardStateAction #15736

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
Jan 4, 2016
Merged

Make cluster state external to o.e.c.a.s.ShardStateAction #15736

merged 7 commits into from
Jan 4, 2016

Conversation

jasontedor
Copy link
Member

This commit modifies the handling of cluster states in
o.e.c.a.s.ShardStateAction so that all necessary state is obtained
externally to the ShardStateAction#shardFailed and
ShardStateAction#shardStarted methods. This refactoring permits the
removal of the ClusterService field from ShardStateAction.

@jasontedor
Copy link
Member Author

The primary motivator for this change is ongoing work for the next step of #14252 (handling when we send a shard failure to a node that we thought was the master but is no longer the master).

This commit modifies the handling of cluster states in
o.e.c.a.s.ShardStateAction so that all necessary state is obtained
externally to the ShardStateAction#shardFailed and
ShardStateAction#shardStarted methods. This refactoring permits the
removal of the ClusterService field from ShardStateAction.
@nik9000
Copy link
Member

nik9000 commented Jan 4, 2016

Makes sense to me but I suspect @bleskes will give final review.

}

private void innerShardFailed(final ShardRouting shardRouting, final String indexUUID, final DiscoveryNode masterNode, final String message, final Throwable failure, TimeValue timeout, Listener listener) {
private void innerShardFailed(final ClusterState clusterState, final ShardRouting shardRouting, final String indexUUID, final String message, final Throwable failure, TimeValue timeout, Listener listener) {
Copy link
Contributor

Choose a reason for hiding this comment

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

does this inner shard failed buy us anything now? can't it be folded into one of the shardFailed variants?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I was leaning towards this last night as well and I'm glad to see that you think the same.

Copy link
Member Author

Choose a reason for hiding this comment

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

@bleskes Pushed 1a131cf.

@bleskes
Copy link
Contributor

bleskes commented Jan 4, 2016

Left some very minor comments. All in the spirit of clean ups - which is what this Pr seems to be about...

This commit restores logging the ShardRouting#shardId at the front of
the log messages in ShardStateAction. The reason for this is so that
shard-level log messages have the format "[component][node][shard]
message".
@jasontedor
Copy link
Member Author

@bleskes Thanks for the comments and additional suggestions. I've pushed more commits to address.

@@ -158,7 +164,17 @@ public void clusterStateProcessed(String source, ClusterState oldState, ClusterS
}
}

class ShardFailedClusterStateHandler implements ClusterStateTaskExecutor<ShardRoutingEntry> {
private static class ShardFailedClusterStateHandler implements ClusterStateTaskExecutor<ShardRoutingEntry> {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I know this was already the name, but can we call this ShardFailedClusterStateTaskExecutor? It will help also with it being a member of ShardFailedTransportHandler .

Copy link
Member Author

Choose a reason for hiding this comment

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

@bleskes I pushed 8a793b6.

@bleskes
Copy link
Contributor

bleskes commented Jan 4, 2016

LGTM. Left one minor naming suggestion, no need for another review.

jasontedor added a commit that referenced this pull request Jan 4, 2016
…state-refactoring

Make cluster state external to o.e.c.a.s.ShardStateAction
@jasontedor jasontedor merged commit 06851b7 into elastic:master Jan 4, 2016
@jasontedor jasontedor deleted the shard-state-action-cluster-state-refactoring branch January 4, 2016 21:22
@jasontedor jasontedor removed the review label Jan 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants