/** * Add a block to the block collection which will be * invalidated on the specified datanode. */ synchronized void add(final Block block, final DatanodeInfo datanode, final boolean log) { LightWeightHashSet<Block> set = getBlocksSet(datanode, block); if (set == null) { set = new LightWeightHashSet<>(); putBlocksSet(datanode, block, set); } if (set.add(block)) { if (blockIdManager.isStripedBlock(block)) { numECBlocks.increment(); } else { numBlocks.increment(); } if (log) { NameNode.blockStateChangeLog.debug("BLOCK* {}: add {} to {}", getClass().getSimpleName(), block, datanode); } } }