|
@@ -554,7 +554,7 @@ public class BlockManager implements BlockStatsMXBean {
|
|
|
numReplicas.decommissionedAndDecommissioning();
|
|
|
|
|
|
if (block instanceof BlockInfo) {
|
|
|
- BlockCollection bc = ((BlockInfo) block).getBlockCollection();
|
|
|
+ BlockCollection bc = getBlockCollection((BlockInfo)block);
|
|
|
String fileName = (bc == null) ? "[orphaned]" : bc.getName();
|
|
|
out.print(fileName + ": ");
|
|
|
}
|
|
@@ -1344,7 +1344,7 @@ public class BlockManager implements BlockStatsMXBean {
|
|
|
for (int priority = 0; priority < blocksToReplicate.size(); priority++) {
|
|
|
for (BlockInfo block : blocksToReplicate.get(priority)) {
|
|
|
// block should belong to a file
|
|
|
- bc = blocksMap.getBlockCollection(block);
|
|
|
+ bc = getBlockCollection(block);
|
|
|
// abandoned block or block reopened for append
|
|
|
if(bc == null || (bc.isUnderConstruction() && block.equals(bc.getLastBlock()))) {
|
|
|
neededReplications.remove(block, priority); // remove from neededReplications
|
|
@@ -1428,7 +1428,7 @@ public class BlockManager implements BlockStatsMXBean {
|
|
|
int priority = rw.priority;
|
|
|
// Recheck since global lock was released
|
|
|
// block should belong to a file
|
|
|
- bc = blocksMap.getBlockCollection(block);
|
|
|
+ bc = getBlockCollection(block);
|
|
|
// abandoned block or block reopened for append
|
|
|
if(bc == null || (bc.isUnderConstruction() && block.equals(bc.getLastBlock()))) {
|
|
|
neededReplications.remove(block, priority); // remove from neededReplications
|
|
@@ -2531,7 +2531,7 @@ public class BlockManager implements BlockStatsMXBean {
|
|
|
int numCurrentReplica = countLiveNodes(storedBlock);
|
|
|
if (storedBlock.getBlockUCState() == BlockUCState.COMMITTED
|
|
|
&& numCurrentReplica >= minReplication) {
|
|
|
- completeBlock(storedBlock.getBlockCollection(), storedBlock, false);
|
|
|
+ completeBlock(getBlockCollection(storedBlock), storedBlock, false);
|
|
|
} else if (storedBlock.isComplete() && result == AddBlockResult.ADDED) {
|
|
|
// check whether safe replication is reached for the block
|
|
|
// only complete blocks are counted towards that.
|
|
@@ -2569,7 +2569,7 @@ public class BlockManager implements BlockStatsMXBean {
|
|
|
// it will happen in next block report otherwise.
|
|
|
return block;
|
|
|
}
|
|
|
- BlockCollection bc = storedBlock.getBlockCollection();
|
|
|
+ BlockCollection bc = getBlockCollection(storedBlock);
|
|
|
assert bc != null : "Block must belong to a file";
|
|
|
|
|
|
// add block to the datanode
|
|
@@ -2964,7 +2964,8 @@ public class BlockManager implements BlockStatsMXBean {
|
|
|
BlockPlacementPolicy replicator) {
|
|
|
assert namesystem.hasWriteLock();
|
|
|
// first form a rack to datanodes map and
|
|
|
- BlockCollection bc = getBlockCollection(b);
|
|
|
+ BlockInfo bi = getStoredBlock(b);
|
|
|
+ BlockCollection bc = getBlockCollection(bi);
|
|
|
final BlockStoragePolicy storagePolicy = storagePolicySuite.getPolicy(bc.getStoragePolicyID());
|
|
|
final List<StorageType> excessTypes = storagePolicy.chooseExcess(
|
|
|
replication, DatanodeStorageInfo.toStorageTypes(nonExcess));
|
|
@@ -3101,7 +3102,7 @@ public class BlockManager implements BlockStatsMXBean {
|
|
|
// necessary. In that case, put block on a possibly-will-
|
|
|
// be-replicated list.
|
|
|
//
|
|
|
- BlockCollection bc = blocksMap.getBlockCollection(block);
|
|
|
+ BlockCollection bc = getBlockCollection(storedBlock);
|
|
|
if (bc != null) {
|
|
|
namesystem.decrementSafeBlockCount(storedBlock);
|
|
|
updateNeededReplications(storedBlock, -1, 0);
|
|
@@ -3617,8 +3618,8 @@ public class BlockManager implements BlockStatsMXBean {
|
|
|
return blocksMap.addBlockCollection(block, bc);
|
|
|
}
|
|
|
|
|
|
- public BlockCollection getBlockCollection(Block b) {
|
|
|
- return blocksMap.getBlockCollection(b);
|
|
|
+ public BlockCollection getBlockCollection(BlockInfo b) {
|
|
|
+ return namesystem.getBlockCollection(b.getBlockCollectionId());
|
|
|
}
|
|
|
|
|
|
/** @return an iterator of the datanodes. */
|