tanvipenumudy commented on code in PR #5391:
URL: https://github.com/apache/ozone/pull/5391#discussion_r1498661171


##########
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

Review Comment:
   Good idea, I have made changes for resolving node location for reads from 
non-datanode hosts within `KeyManagerImpl` itself instead of making a call to 
the original `ScmBlockLocationProtocol#sortDatanodes` method.



-- 
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]

Reply via email to