tanvipenumudy commented on code in PR #5391:
URL: https://github.com/apache/ozone/pull/5391#discussion_r1487211328
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java:
##########
@@ -1847,24 +1849,49 @@ void sortDatanodes(String clientMachine, OmKeyInfo...
keyInfos) {
}
}
- private List<DatanodeDetails> sortDatanodes(String clientMachine,
+ public List<DatanodeDetails> sortDatanodes(String clientMachine,
List<DatanodeDetails> nodes, OmKeyInfo keyInfo, List<String> nodeList) {
- List<DatanodeDetails> sortedNodes = null;
- try {
- sortedNodes = scmClient.getBlockClient()
- .sortDatanodes(nodeList, clientMachine);
- if (LOG.isDebugEnabled()) {
- LOG.debug("Sorted datanodes {} for client {}, result: {}", nodes,
- clientMachine, sortedNodes);
+ DatanodeDetails client = null;
+ List<DatanodeDetails> possibleClients =
+ getClientNodesByAddress(clientMachine, nodes);
+ if (possibleClients.size() > 0) {
+ client = possibleClients.get(0);
+ } else {
+ /**
+ * In case of read from a non-datanode host, return
+ * {@link ScmBlockLocationProtocol#sortDatanodes(List<String>, String)}.
+ */
+ try {
+ return scmClient.getBlockClient()
+ .sortDatanodes(nodeList, clientMachine);
+ } catch (IOException e) {
+ LOG.warn("Unable to sort datanodes based on distance to client, "
Review Comment:
Changed the logging level to `debug`. Created a follow-up task:
[HDDS-10357](https://issues.apache.org/jira/browse/HDDS-10357) for adding more
granular metrics as suggested, thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]