I was looking at the current patch and I think I found a bug on it.
On UnderReplicatedBlocks.java, the following method was added:
+ * Return an iterator of all blocks that have no valid replicas.
+ * These are either blocks with no replicas or all existing replicas
+ * are corrupted. Such blocks are at level 2.
+ public synchronized Iterator<Block> iteratorBadBlocks()
+ return priorityQueues.get(2).iterator();
It assumes all blocks on queue 2 have 0 replicas. However according to get getPriority() on the same source file, we can see that level 2 is also used for blocks whose number of replicas times 3 is bigger than expected replicas:
} else if(curReplicas*3<expectedReplicas)
So, if a block has 2 replicas, but it is expected to have 3, it will also be kept in the queue with priority 2. I'm fixing that by adding an extra check on the real number of replicas a block has before adding it to the list returned by BlockManager.getCorruptFiles() (previously BockManager.getBadFiles()). Please let me know what you guys think about it.