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

Add post-batch method to cluster state task executors #15482

Closed
jasontedor opened this issue Dec 16, 2015 · 0 comments
Closed

Add post-batch method to cluster state task executors #15482

jasontedor opened this issue Dec 16, 2015 · 0 comments
Assignees
Labels
:Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. >enhancement

Comments

@jasontedor
Copy link
Member

Today, when executing cluster state update tasks, we have per-task hooks that can be used to execute logic after a cluster state update batch is processed. What is missing is a single per-batch hook that can be used to execute logic after a cluster state update batch is processed.

One place where this is a concern is in o.e.c.a.s.ShardStateAction where, after a batch of shard failures are processed, there is the possibility that a reroute will be required. Without the post-batch hook, this logic is placed in the post-task hook causing reroutes when needed to be executed many times.

@Override
public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
    if (oldState != newState && newState.getRoutingNodes().unassigned().size() > 0) {
        logger.trace("unassigned shards after shard failures. scheduling a reroute.");
        routingService.reroute("unassigned shards after shard failures, scheduling a reroute");
    }
}

With a post-batch hook, this logic could be executed exactly once after successful publication of the new cluster state.

@jasontedor jasontedor self-assigned this Dec 16, 2015
jasontedor added a commit that referenced this issue Dec 17, 2015
This commit adds a callback for a cluster state task executor that will
be invoked if the execution of a batch of cluster state update tasks
led to a new cluster state and that new cluster state was successfully
published.

Closes #15482
@clintongormley clintongormley added :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. and removed :Cluster labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. >enhancement
Projects
None yet
Development

No branches or pull requests

2 participants