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

Avoid NPE when disassociateDeadNodes is executed for a node present in the desired balance #91659

Merged
merged 9 commits into from Nov 18, 2022
Expand Up @@ -415,13 +415,17 @@ private DiscoveryNode findRelocationTarget(
) {
for (final var nodeId : desiredNodeIds) {
// TODO consider ignored nodes here too?
if (nodeId.equals(shardRouting.currentNodeId()) == false) {
final var currentNode = routingNodes.node(nodeId);
final var decision = canAllocateDecider.apply(shardRouting, currentNode);
logger.trace("relocate {} to {}: {}", shardRouting, nodeId, decision);
if (decision.type() == Decision.Type.YES) {
return currentNode.node();
}
if (nodeId.equals(shardRouting.currentNodeId())) {
continue;
}
final var node = routingNodes.node(nodeId);
if (node == null) { // node theft the cluster while reconciliation is still in progress
idegtiarenko marked this conversation as resolved.
Show resolved Hide resolved
continue;
idegtiarenko marked this conversation as resolved.
Show resolved Hide resolved
}
final var decision = canAllocateDecider.apply(shardRouting, node);
logger.trace("relocate {} to {}: {}", shardRouting, nodeId, decision);
if (decision.type() == Decision.Type.YES) {
return node.node();
}
}

Expand Down