|
@@ -3190,6 +3190,9 @@ public class BlockManager {
|
|
|
* @return number of blocks scheduled for removal during this iteration.
|
|
|
*/
|
|
|
private int invalidateWorkForOneNode(String nodeId) {
|
|
|
+ final List<Block> toInvalidate;
|
|
|
+ final DatanodeDescriptor dn;
|
|
|
+
|
|
|
namesystem.writeLock();
|
|
|
try {
|
|
|
// blocks should not be replicated or removed if safe mode is on
|
|
@@ -3199,10 +3202,23 @@ public class BlockManager {
|
|
|
}
|
|
|
// get blocks to invalidate for the nodeId
|
|
|
assert nodeId != null;
|
|
|
- return invalidateBlocks.invalidateWork(nodeId);
|
|
|
+ dn = datanodeManager.getDatanode(nodeId);
|
|
|
+ if (dn == null) {
|
|
|
+ invalidateBlocks.remove(nodeId);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ toInvalidate = invalidateBlocks.invalidateWork(nodeId, dn);
|
|
|
+ if (toInvalidate == null) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
} finally {
|
|
|
namesystem.writeUnlock();
|
|
|
}
|
|
|
+ if (NameNode.stateChangeLog.isInfoEnabled()) {
|
|
|
+ NameNode.stateChangeLog.info("BLOCK* " + getClass().getSimpleName()
|
|
|
+ + ": ask " + dn + " to delete " + toInvalidate);
|
|
|
+ }
|
|
|
+ return toInvalidate.size();
|
|
|
}
|
|
|
|
|
|
boolean blockHasEnoughRacks(Block b) {
|