|
@@ -1116,7 +1116,7 @@ public class BlockManager {
|
|
|
// Move the block-replication into a "pending" state.
|
|
|
// The reason we use 'pending' is so we can retry
|
|
|
// replications that fail after an appropriate amount of time.
|
|
|
- pendingReplications.add(block, targets.length);
|
|
|
+ pendingReplications.increment(block, targets.length);
|
|
|
if(NameNode.stateChangeLog.isDebugEnabled()) {
|
|
|
NameNode.stateChangeLog.debug(
|
|
|
"BLOCK* block " + block
|
|
@@ -1162,8 +1162,11 @@ public class BlockManager {
|
|
|
|
|
|
/**
|
|
|
* Choose target datanodes according to the replication policy.
|
|
|
- * @throws IOException if the number of targets < minimum replication.
|
|
|
- * @see BlockPlacementPolicy#chooseTarget(String, int, DatanodeDescriptor, HashMap, long)
|
|
|
+ *
|
|
|
+ * @throws IOException
|
|
|
+ * if the number of targets < minimum replication.
|
|
|
+ * @see BlockPlacementPolicy#chooseTarget(String, int, DatanodeDescriptor,
|
|
|
+ * List, boolean, HashMap, long)
|
|
|
*/
|
|
|
public DatanodeDescriptor[] chooseTarget(final String src,
|
|
|
final int numOfReplicas, final DatanodeDescriptor client,
|
|
@@ -1696,14 +1699,15 @@ public class BlockManager {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Faster version of {@link addStoredBlock()}, intended for use with
|
|
|
- * initial block report at startup. If not in startup safe mode, will
|
|
|
- * call standard addStoredBlock().
|
|
|
- * Assumes this method is called "immediately" so there is no need to
|
|
|
- * refresh the storedBlock from blocksMap.
|
|
|
- * Doesn't handle underReplication/overReplication, or worry about
|
|
|
+ * Faster version of
|
|
|
+ * {@link #addStoredBlock(BlockInfo, DatanodeDescriptor, DatanodeDescriptor, boolean)}
|
|
|
+ * , intended for use with initial block report at startup. If not in startup
|
|
|
+ * safe mode, will call standard addStoredBlock(). Assumes this method is
|
|
|
+ * called "immediately" so there is no need to refresh the storedBlock from
|
|
|
+ * blocksMap. Doesn't handle underReplication/overReplication, or worry about
|
|
|
* pendingReplications or corruptReplicas, because it's in startup safe mode.
|
|
|
* Doesn't log every block, because there are typically millions of them.
|
|
|
+ *
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
private void addStoredBlockImmediate(BlockInfo storedBlock,
|
|
@@ -2185,7 +2189,7 @@ public class BlockManager {
|
|
|
//
|
|
|
// Modify the blocks->datanode map and node's map.
|
|
|
//
|
|
|
- pendingReplications.remove(block);
|
|
|
+ pendingReplications.decrement(block);
|
|
|
|
|
|
// blockReceived reports a finalized block
|
|
|
Collection<BlockInfo> toAdd = new LinkedList<BlockInfo>();
|
|
@@ -2291,7 +2295,7 @@ public class BlockManager {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Simpler, faster form of {@link countNodes()} that only returns the number
|
|
|
+ * Simpler, faster form of {@link #countNodes(Block)} that only returns the number
|
|
|
* of live nodes. If in startup safemode (or its 30-sec extension period),
|
|
|
* then it gains speed by ignoring issues of excess replicas or nodes
|
|
|
* that are decommissioned or in process of becoming decommissioned.
|
|
@@ -2440,6 +2444,8 @@ public class BlockManager {
|
|
|
addToInvalidates(block);
|
|
|
corruptReplicas.removeFromCorruptReplicasMap(block);
|
|
|
blocksMap.removeBlock(block);
|
|
|
+ // Remove the block from pendingReplications
|
|
|
+ pendingReplications.remove(block);
|
|
|
}
|
|
|
|
|
|
public BlockInfo getStoredBlock(Block block) {
|