This is an automated email from the ASF dual-hosted git repository. mhubail pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/asterixdb.git
commit cba9cbe380e04a183caadc13497c97d0db6ff31c Author: Murtadha Hubail <[email protected]> AuthorDate: Thu Sep 5 05:06:05 2019 +0300 [NO ISSUE][CLUS] Attempt To Get Node IP From Existing Nodes - user model changes: no - storage format changes: no - interface changes: no Details: - When we fail to resolve a node's host to an IP on node failure/removal, attempt to find its IP from the list of existing nodes. This is done to prevent failing the node removal operation when the node's host address cannot be resolved anymore. Change-Id: I8f12a3dbb84a4cb731f1379efd65ca50606a8b07 Reviewed-on: https://asterix-gerrit.ics.uci.edu/3544 Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Reviewed-by: Till Westmann <[email protected]> --- .../hyracks/control/cc/cluster/NodeManager.java | 24 ++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/cluster/NodeManager.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/cluster/NodeManager.java index 4f76ced..0e374a6 100644 --- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/cluster/NodeManager.java +++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/cluster/NodeManager.java @@ -205,8 +205,19 @@ public class NodeManager implements INodeManager { nodeRegistry.forEach(nodeFunction::apply); } - private void removeNodeFromIpAddressMap(String nodeId, NodeControllerState ncState) throws HyracksException { - InetAddress ipAddress = getIpAddress(ncState); + private void removeNodeFromIpAddressMap(String nodeId, NodeControllerState ncState) { + InetAddress ipAddress; + try { + ipAddress = getIpAddress(ncState); + } catch (Exception e) { + LOGGER.warn("failed to get ip address of node {}; attempting to find it on existing nodes lists", nodeId, + e); + ipAddress = findNodeIpById(nodeId); + } + if (ipAddress == null) { + LOGGER.warn("failed to get ip address of node {}", nodeId); + return; + } Set<String> nodes = ipAddressNodeNameMap.get(ipAddress); if (nodes != null) { nodes.remove(nodeId); @@ -242,4 +253,13 @@ public class NodeManager implements INodeManager { } }); } + + private InetAddress findNodeIpById(String nodeId) { + for (Map.Entry<InetAddress, Set<String>> ipToNodesEntry : ipAddressNodeNameMap.entrySet()) { + if (ipToNodesEntry.getValue().contains(nodeId)) { + return ipToNodesEntry.getKey(); + } + } + return null; + } }
