errose28 commented on code in PR #8402:
URL: https://github.com/apache/ozone/pull/8402#discussion_r2080129525


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java:
##########
@@ -1599,119 +1696,56 @@ private ContainerProtos.ContainerChecksumInfo 
updateAndGetContainerChecksum(KeyV
         BlockData blockData = blockIterator.nextBlock();
         List<ContainerProtos.ChunkInfo> chunkInfos = blockData.getChunks();
         // TODO: Add empty blocks to the merkle tree. Done in HDDS-10374, 
needs to be backported.
-        merkleTree.addChunks(blockData.getLocalID(), chunkInfos);
+        // Assume all chunks are healthy when building the tree from metadata. 
Scanner will identify corruption when
+        // it runs after.
+        merkleTree.addChunks(blockData.getLocalID(), true, chunkInfos);
       }
     }
-    ContainerProtos.ContainerChecksumInfo checksumInfo = checksumManager
-        .writeContainerDataTree(containerData, merkleTree);
-    return checksumInfo;
+    return checksumManager.writeContainerDataTree(containerData, merkleTree);
   }
 
   /**
-   * Handle missing block. It reads the missing block data from the peer 
datanode and writes it to the local container.
-   * If the block write fails, the block commit sequence id of the container 
and the block are not updated.
+   * Read chunks from a peer datanode and use them to repair our container.
+   *
+   * We will keep pulling chunks from the peer until we encounter an error. At 
that point we will stop trying to
+   * reconcile this block instead of trying to write it with holes. Whatever 
data we have pulled up to that point will

Review Comment:
   I need to update the javadoc, the current explanation isn't totally 
accurate. We will stop pulling chunks when the previous chunk in the block is 
not present as determined by the `previousChunkPresent` method. This could 
happen because there was an error obtaining the chunk, but it could also happen 
if the peer had corrupted data for this chunk and we chose not to pull it. We 
will also be able to proceed with repair if our chunk is corrupted and we fail 
to pull the healthy one from the peer, because we still have something in the 
block file that we can write past.



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