F64116045 commented on PR #11199:
URL: https://github.com/apache/ozone/pull/11199#issuecomment-5550654422

   Thanks @sodonnel for the question.
   
   From my reading, block deletion does not change the data checksum reported 
to SCM. [The checksum is first generated when the container is 
closed](https://github.com/apache/ozone/blob/fb30b6c106509f9345a950dfc6b452a5337d92e6/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java#L1685-L1691).
   When a block is deleted, its entry is retained in the checksum tree with the 
same block checksum:
   ```
   Before deletion: blockID=N, checksum=X, deleted=false
   After deletion:  blockID=N, checksum=X, deleted=true
   ```
   [The deletion path rebuilds the block entry from its existing chunk metadata 
and marks it as 
deleted](https://github.com/apache/ozone/blob/fb30b6c106509f9345a950dfc6b452a5337d92e6/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/checksum/ContainerMerkleTreeWriter.java#L176-L190).
 
   [The block checksum is calculated before the chunk-level entries are 
cleared](https://github.com/apache/ozone/blob/fb30b6c106509f9345a950dfc6b452a5337d92e6/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/checksum/ContainerMerkleTreeWriter.java#L270-L307).
   Since [the container checksum is calculated from all block checksums in the 
tree](https://github.com/apache/ozone/blob/fb30b6c106509f9345a950dfc6b452a5337d92e6/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/checksum/ContainerMerkleTreeWriter.java#L199-L215),
 the value X remains part of the calculation after deletion.
   Therefore, block deletion preserves the current container checksum rather 
than generating a new value for each delete.


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