adoroszlai commented on code in PR #10594:
URL: https://github.com/apache/ozone/pull/10594#discussion_r3467665688


##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/checksum/BaseFileChecksumHelper.java:
##########
@@ -73,28 +73,27 @@ public abstract class BaseFileChecksumHelper {
       long length,
       OzoneClientConfig.ChecksumCombineMode checksumCombineMode,
       ClientProtocol rpcClient) throws IOException {
+    this(volume, bucket, keyName, length, checksumCombineMode, rpcClient, 
null);

Review Comment:
   This constructor is used in only 2 test cases, can you please remove it?
   
   This test helper can pass `keyInfo` for RATIS, just like it does for EC:
   
   
https://github.com/apache/ozone/blob/cc4f52a9d09197aa7c2da80a1de38f7f9e73d4f3/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/checksum/TestFileChecksumHelper.java#L144-L150
   
   Key info needs to be looked up for the other call:
   
   
https://github.com/apache/ozone/blob/cc4f52a9d09197aa7c2da80a1de38f7f9e73d4f3/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/checksum/TestFileChecksumHelper.java#L349-L350
   
   Afterwards we may be able to get rid of the `keyInfo == null` case in 
`fetchBlocks()`.



##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/checksum/ECFileChecksumHelper.java:
##########
@@ -79,13 +87,32 @@ protected List<ContainerProtos.ChunkInfo> 
getChunkInfos(OmKeyLocationInfo
         // The stripe checksum we need to calculate checksums is only stored on
         // replica_index = 1 and all the parity nodes.
         nodes.add(dn);
+        selectedReplicaIndexes.put(dn, replicaIndex);
       }
     }
 
-    pipeline = pipeline.toBuilder()
+    // Build a deterministic pipeline ID from the sorted node UUIDs so that
+    // XceiverClientManager can cache and reuse the gRPC connection across 
files
+    // that share the same EC placement group (avoids a new connection per 
file).
+    List<DatanodeDetails> sortedNodes = new ArrayList<>(nodes);
+    sortedNodes.sort(Comparator.comparing(DatanodeDetails::getUuidString));
+    String nodeKey = sortedNodes.stream()
+        .map(DatanodeDetails::getUuidString)

Review Comment:
   `sortedNodes` is used only to define the order.  It can be merged into the 
stream:
   
   ```suggestion
       String nodeKey = nodes.stream()
           .map(DatanodeDetails::getUuidString)
           .sorted()
   ```
   
   (Also need to remove unnecessary imports.)



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