sodonnel commented on code in PR #6520:
URL: https://github.com/apache/ozone/pull/6520#discussion_r1565550323


##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/ECBlockOutputStream.java:
##########
@@ -115,20 +115,43 @@ ContainerCommandResponseProto> executePutBlock(boolean 
close,
     }
 
     BlockData checksumBlockData = null;
+    boolean foundStripeChecksum = false;
+    BlockID blockID = null;
     //Reverse Traversal as all parity will have checksumBytes
     for (int i = blockData.length - 1; i >= 0; i--) {
       BlockData bd = blockData[i];
       if (bd == null) {
         continue;
       }
+      if (blockID == null) {
+        // store the BlockID for logging
+        blockID = bd.getBlockID();
+      }
       List<ChunkInfo> chunks = bd.getChunks();
-      if (chunks != null && chunks.size() > 0 && chunks.get(0)
-          .hasStripeChecksum()) {
-        checksumBlockData = bd;
-        break;
+      if (chunks != null && chunks.size() > 0) {
+        if (chunks.get(0).hasStripeChecksum()) {
+          checksumBlockData = bd;
+          foundStripeChecksum = true;
+          break;
+        } else {
+          ChunkInfo chunk = chunks.get(0);
+          LOG.info("The first chunk in block with index {} does not have 
stripeChecksum. BlockID: {}, Block size: {}." +
+                  " Chunk length: {}, Chunk offset: {}, hasChecksumData: {}, 
chunks size: {}.", i, bd.getBlockID(),
+              bd.getSize(), chunk.getLen(), chunk.getOffset(), 
chunk.hasChecksumData(), chunks.size());
+        }
+
+        if (chunks.get(0).hasChecksumData()) {
+          checksumBlockData = bd;
+          break;
+        }
       }
     }
 
+    if (!foundStripeChecksum) {
+      LOG.warn("Could not find stripeChecksum in any index for blockData with 
BlockID {}, length {} and " +
+              "blockGroupLength {}.", blockID, blockData.length, 
blockGroupLength);
+    }

Review Comment:
   Need to change the exception at line 160 to not throw if nothing has been 
found too. Infact, this log could just go into the else at line 160, rather 
than the throw.



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