To revive this discussion, I would have few comments about block reports.
Processing a single block report has mainly two parts. The first part is to compute the difference between NN state and the report.
The second stage involves applying the diff to NN - which contains blocksToAdd, blocksToRemove, blocksToInvalidat.
1. Now we have explicit Received requests sent form datanodes to the namenode,
hence the number of blocksToAdd should be very small.
2. blocksToInvalidate consist of blocks that do not belong to any file, which is a abnormal situations.
Hence, the number thereof should also be very small.
3. We do not have explicit ACKs for blocks that are deleted from datanodes. Hence, the diff will contain all such deleted blocks.
If we extend the block report interval to let's say 24 hours, we migh have a huge number of blocks that have been deleted, and need to be processed.
I think it will be very beneficial to introduce explicit deletion acks.
Since we care more about the blockReceived in general, than blockDeleted, we can send the deletion acks whenever we have any blockReceived acks to sent at the datanode side.
Otherwise, we send the block deletion acks in some interval.
With this change, the block report interval can be extended to let's say two times the basic interval.
– Also a small change need to be made for sending blockDeleted ack.
When the block invalidate command comes to the datanode, it should synchronously rename the block file (to some invalid block name).
Then it can immediately notify the namenode that the block has been deleted.
– Another improvement can be made on NN side: We can process the entire list of blocks within the FSNamesystem instead of processing them one-by-one.
This saves some repetitive computation.
I am attaching a diff that introduces these changes.