JacksonYao287 commented on PR #3360:
URL: https://github.com/apache/ozone/pull/3360#issuecomment-1119204766

   Another question comes to my mind. suppose we have contianer c1 and three 
replicas r1, r2,r3 on datanode d1, d2,d3 ,respectively. if d3 is dead, r3 will 
lost, so RM will find this situation and copy r2 to datanode d4 as r4. after a 
while,  some block deletion commands comes to d1, d2,d4 to delete some blocks 
in r1, r2, r4 and the delete transaction will be removed from the 
deleteBlockLog. if d3 resurrects , r3 comes back and has more blocks than r1, 
r2 ,r4, since d3 does not receive those deletion commands. when d3 sends a 
container report to scm , the following function in containerReportHandler will 
change the container stats to the same as r3, since r3 has a bigger KeyCounts 
and UsedBytes.
   ```
     private long calculateUsage(ContainerInfo containerInfo, long lastValue,
         long thisValue) {
       if (containerInfo.getState().equals(HddsProtos.LifeCycleState.OPEN)) {
         // Open containers are generally growing in key count and size, the
         // overall size should be the min of all reported replicas.
         return Math.min(lastValue, thisValue);
       } else {
         // Containers which are not open can only shrink in size, so use the
         // largest values reported.
         return Math.max(lastValue, thisValue);
       }
     }
   ```
   since those zombie blocks will not be deleted from r3(no deletion command 
for these blocks will be received) , the KeyCounts and UsedBytes will not be 
zero, and thus , the container replica at datanodes and the reference at scm 
will never be removed. 


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