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

Fix inconsistent cluster state and ensure weigh away exception check only for data nodes #6327

Merged
merged 5 commits into from
Feb 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,16 @@ private void executeHealth(
if (validationPredicate.test(currentState)) {
ClusterHealthResponse clusterHealthResponse = getResponse(request, currentState, waitCount, TimeoutState.OK);
if (request.ensureNodeWeighedIn() && clusterHealthResponse.hasDiscoveredClusterManager()) {
DiscoveryNode localNode = clusterService.state().getNodes().getLocalNode();
assert request.local() == true : "local node request false for request for local node weighed in";
boolean weighedAway = WeightedRoutingUtils.isWeighedAway(localNode.getId(), clusterService.state());
if (weighedAway) {
listener.onFailure(new NodeWeighedAwayException("local node is weighed away"));
return;
DiscoveryNode localNode = currentState.getNodes().getLocalNode();
if (localNode.isDataNode()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should it be made more generic based on roles?

Copy link
Contributor Author

@anshu1106 anshu1106 Feb 16, 2023

Choose a reason for hiding this comment

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

we can do that but can we say that all data nodes have DATA_ROLE? And warm nodes don't have DATA_ROLE

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added a todo to take this later

assert request.local() == true : "local node request false for request for local node weighed in";
boolean weighedAway = WeightedRoutingUtils.isWeighedAway(localNode.getId(), currentState);
if (weighedAway) {
listener.onFailure(new NodeWeighedAwayException("local node is weighed away"));
return;
}
}
}

listener.onResponse(clusterHealthResponse);
} else {
final ClusterStateObserver observer = new ClusterStateObserver(
Expand Down