szetszwo commented on code in PR #10633:
URL: https://github.com/apache/ozone/pull/10633#discussion_r3561674251


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyRequest.java:
##########
@@ -215,11 +243,21 @@ protected List<OmKeyLocationInfo> allocateBlock(
     }
     for (AllocatedBlock allocatedBlock : allocatedBlocks) {
       BlockID blockID = new BlockID(allocatedBlock.getBlockID());
+      Pipeline pipeline = allocatedBlock.getPipeline();
+      if (sortedByPipeline != null) {
+        final List<DatanodeDetails> nodes = pipeline.getNodes();
+        final List<? extends DatanodeDetails> sorted = sortedByPipeline
+            .computeIfAbsent(pipeline.getId(),
+                id -> keyManager.sortDatanodesForWrite(nodes, 
omClientMachine));

Review Comment:
   We should also pass the `clusterMap`.



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java:
##########
@@ -2165,7 +2166,7 @@ private void sortDatanodes(String clientMachine, 
OmKeyInfo keyInfo) {
 
   private void sortDatanodes(String clientMachine, List<OmKeyInfo> keyInfos) {
     if (keyInfos != null && clientMachine != null) {
-      final Map<Set<String>, List<? extends DatanodeDetails>> sortedPipelines 
= new HashMap<>();
+      final Map<PipelineID, List<? extends DatanodeDetails>> sortedPipelines = 
new HashMap<>();

Review Comment:
   Just a question: why change key from UUIDs to PipelineID?
   
   One difference I can see is that the set of UUIDs (i.e. datanodes) can have 
multiple pipelines.  In such case, we sort the same set of datanodes multiple 
times.  Not sure if this case is common.



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