This is an automated email from the ASF dual-hosted git repository.

sodonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new c61ee3ea3e HDDS-7787. GetChecksum for EC files can fail intermittently 
with IndexOutOfBounds exception (#4180)
c61ee3ea3e is described below

commit c61ee3ea3ea096caf536d0530e3e75e5a8450663
Author: Stephen O'Donnell <[email protected]>
AuthorDate: Tue Jan 17 11:08:46 2023 +0000

    HDDS-7787. GetChecksum for EC files can fail intermittently with 
IndexOutOfBounds exception (#4180)
---
 .../ozone/client/checksum/ECFileChecksumHelper.java   | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git 
a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/checksum/ECFileChecksumHelper.java
 
b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/checksum/ECFileChecksumHelper.java
index ab1473e9e8..0476bcc30a 100644
--- 
a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/checksum/ECFileChecksumHelper.java
+++ 
b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/checksum/ECFileChecksumHelper.java
@@ -161,25 +161,22 @@ public class ECFileChecksumHelper extends 
BaseFileChecksumHelper {
 
     Pipeline pipeline = keyLocationInfo.getPipeline();
 
-    List<DatanodeDetails> nodes = pipeline.getNodes();
-    List<DatanodeDetails> newNodes = new ArrayList<>();
+    List<DatanodeDetails> nodes = new ArrayList<>();
     ECReplicationConfig repConfig = (ECReplicationConfig)
         pipeline.getReplicationConfig();
-    int totalNodes = repConfig.getRequiredNodes();
-    int parity = repConfig.getParity();
 
-    // Filtering the nodes that has the checksumBytes
-    for (int i = 0; i < nodes.size(); i++) {
-      if (i > 0 && i < totalNodes - parity) {
-        continue;
+    for (DatanodeDetails dn : pipeline.getNodes()) {
+      int replicaIndex = pipeline.getReplicaIndex(dn);
+      if (replicaIndex == 1 || replicaIndex > repConfig.getData()) {
+        // The stripe checksum we need to calculate checksums is only stored on
+        // replica_index = 1 and all the parity nodes.
+        nodes.add(dn);
       }
-      newNodes.add(nodes.get(i));
     }
-
     pipeline = Pipeline.newBuilder(pipeline)
         .setReplicationConfig(StandaloneReplicationConfig
             .getInstance(HddsProtos.ReplicationFactor.THREE))
-        .setNodes(newNodes)
+        .setNodes(nodes)
         .build();
 
     boolean success = false;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to