Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
Description
public List<DatanodeDetails> sortDatanodes(List<String> nodes, String clientMachine) { boolean auditSuccess = true; try { NodeManager nodeManager = scm.getScmNodeManager(); Node client = null; List<DatanodeDetails> possibleClients = nodeManager.getNodesByAddress(clientMachine); if (possibleClients.size() > 0) { client = possibleClients.get(0); } List<Node> nodeList = new ArrayList(); nodes.stream().forEach(uuid -> { DatanodeDetails node = nodeManager.getNodeByUuid(uuid); if (node != null) { nodeList.add(node); } }); List<? extends Node> sortedNodeList = scm.getClusterMap() .sortByDistanceCost(client, nodeList, nodes.size()); List<DatanodeDetails> ret = new ArrayList<>(); sortedNodeList.stream().forEach(node -> ret.add((DatanodeDetails)node)); return ret;
Client's node (place in the topology) is looked up via SCMNodeManager.getNodesByAddress. But SCMNodeManager only knows about datanodes. If the request comes from a host which does not run Ozone Datanode, then read will not be topology-aware. While read cannot be host-local in this case, it still could benefit from being rack-local.
Examples where such non-datanode hosts may occur:
- edge nodes
- dedicated metadata nodes
- Docker/Kubernetes containers running only one service