private void invalidateBlock ( Block blk , DatanodeInfo dn , boolean ackRequired ) throws IOException { NameNode . stateChangeLog . info ( "DIR* NameSystem.invalidateBlock: " + blk + " on " + dn . getName ( ) ) ; DatanodeDescriptor node = getDatanode ( dn ) ; if ( node == null ) { throw new IOException ( "Cannot invalidate block " + blk + " because datanode " + dn . getName ( ) + " does not exist." ) ; } // Check how many copies we have of the block. If we have at least one // copy on a live node, then we can delete it. int count = countNodes ( blk ) . liveReplicas ( ) ; if ( count > 1 ) { // delete with ACK addToInvalidates ( blk , dn , ackRequired ) ; removeStoredBlock ( blk , node ) ; if ( NameNode . stateChangeLog . isDebugEnabled ( ) ) { NameNode . stateChangeLog . debug ( "BLOCK* NameSystem.invalidateBlocks: " + blk + " on " + dn . getName ( ) + " listed for deletion." ) ; } } else { NameNode . stateChangeLog . info ( "BLOCK* NameSystem.invalidateBlocks: " + blk + " on " + dn . getName ( ) + " is the only copy and was not deleted." ) ; } }
Invalidates the given block on the given datanode .