|
@@ -543,8 +543,8 @@ public class BlockManager {
|
|
|
int usableReplicas = numReplicas.liveReplicas() +
|
|
|
numReplicas.decommissionedAndDecommissioning();
|
|
|
|
|
|
- if (block instanceof BlockInfoContiguous) {
|
|
|
- BlockCollection bc = ((BlockInfoContiguous) block).getBlockCollection();
|
|
|
+ if (block instanceof BlockInfo) {
|
|
|
+ BlockCollection bc = ((BlockInfo) block).getBlockCollection();
|
|
|
String fileName = (bc == null) ? "[orphaned]" : bc.getName();
|
|
|
out.print(fileName + ": ");
|
|
|
}
|
|
@@ -624,7 +624,7 @@ public class BlockManager {
|
|
|
Block commitBlock) throws IOException {
|
|
|
if(commitBlock == null)
|
|
|
return false; // not committing, this is a block allocation retry
|
|
|
- BlockInfoContiguous lastBlock = bc.getLastBlock();
|
|
|
+ BlockInfo lastBlock = bc.getLastBlock();
|
|
|
if(lastBlock == null)
|
|
|
return false; // no blocks in file yet
|
|
|
if(lastBlock.isComplete())
|
|
@@ -644,11 +644,11 @@ public class BlockManager {
|
|
|
* @throws IOException if the block does not have at least a minimal number
|
|
|
* of replicas reported from data-nodes.
|
|
|
*/
|
|
|
- private BlockInfoContiguous completeBlock(final BlockCollection bc,
|
|
|
+ private BlockInfo completeBlock(final BlockCollection bc,
|
|
|
final int blkIndex, boolean force) throws IOException {
|
|
|
if(blkIndex < 0)
|
|
|
return null;
|
|
|
- BlockInfoContiguous curBlock = bc.getBlocks()[blkIndex];
|
|
|
+ BlockInfo curBlock = bc.getBlocks()[blkIndex];
|
|
|
if(curBlock.isComplete())
|
|
|
return curBlock;
|
|
|
BlockInfoContiguousUnderConstruction ucBlock =
|
|
@@ -660,7 +660,7 @@ public class BlockManager {
|
|
|
if(!force && ucBlock.getBlockUCState() != BlockUCState.COMMITTED)
|
|
|
throw new IOException(
|
|
|
"Cannot complete block: block has not been COMMITTED by the client");
|
|
|
- BlockInfoContiguous completeBlock = ucBlock.convertToCompleteBlock();
|
|
|
+ BlockInfo completeBlock = ucBlock.convertToCompleteBlock();
|
|
|
// replace penultimate block in file
|
|
|
bc.setBlock(blkIndex, completeBlock);
|
|
|
|
|
@@ -678,9 +678,9 @@ public class BlockManager {
|
|
|
return blocksMap.replaceBlock(completeBlock);
|
|
|
}
|
|
|
|
|
|
- private BlockInfoContiguous completeBlock(final BlockCollection bc,
|
|
|
- final BlockInfoContiguous block, boolean force) throws IOException {
|
|
|
- BlockInfoContiguous[] fileBlocks = bc.getBlocks();
|
|
|
+ private BlockInfo completeBlock(final BlockCollection bc,
|
|
|
+ final BlockInfo block, boolean force) throws IOException {
|
|
|
+ BlockInfo[] fileBlocks = bc.getBlocks();
|
|
|
for(int idx = 0; idx < fileBlocks.length; idx++)
|
|
|
if(fileBlocks[idx] == block) {
|
|
|
return completeBlock(bc, idx, force);
|
|
@@ -693,7 +693,7 @@ public class BlockManager {
|
|
|
* regardless of whether enough replicas are present. This is necessary
|
|
|
* when tailing edit logs as a Standby.
|
|
|
*/
|
|
|
- public BlockInfoContiguous forceCompleteBlock(final BlockCollection bc,
|
|
|
+ public BlockInfo forceCompleteBlock(final BlockCollection bc,
|
|
|
final BlockInfoContiguousUnderConstruction block) throws IOException {
|
|
|
block.commitBlock(block);
|
|
|
return completeBlock(bc, block, true);
|
|
@@ -716,7 +716,7 @@ public class BlockManager {
|
|
|
*/
|
|
|
public LocatedBlock convertLastBlockToUnderConstruction(
|
|
|
BlockCollection bc, long bytesToRemove) throws IOException {
|
|
|
- BlockInfoContiguous oldBlock = bc.getLastBlock();
|
|
|
+ BlockInfo oldBlock = bc.getLastBlock();
|
|
|
if(oldBlock == null ||
|
|
|
bc.getPreferredBlockSize() == oldBlock.getNumBytes() - bytesToRemove)
|
|
|
return null;
|
|
@@ -769,7 +769,7 @@ public class BlockManager {
|
|
|
}
|
|
|
|
|
|
private List<LocatedBlock> createLocatedBlockList(
|
|
|
- final BlockInfoContiguous[] blocks,
|
|
|
+ final BlockInfo[] blocks,
|
|
|
final long offset, final long length, final int nrBlocksToReturn,
|
|
|
final AccessMode mode) throws IOException {
|
|
|
int curBlk = 0;
|
|
@@ -799,7 +799,7 @@ public class BlockManager {
|
|
|
return results;
|
|
|
}
|
|
|
|
|
|
- private LocatedBlock createLocatedBlock(final BlockInfoContiguous[] blocks,
|
|
|
+ private LocatedBlock createLocatedBlock(final BlockInfo[] blocks,
|
|
|
final long endPos, final AccessMode mode) throws IOException {
|
|
|
int curBlk = 0;
|
|
|
long curPos = 0;
|
|
@@ -815,7 +815,7 @@ public class BlockManager {
|
|
|
return createLocatedBlock(blocks[curBlk], curPos, mode);
|
|
|
}
|
|
|
|
|
|
- private LocatedBlock createLocatedBlock(final BlockInfoContiguous blk, final long pos,
|
|
|
+ private LocatedBlock createLocatedBlock(final BlockInfo blk, final long pos,
|
|
|
final AccessMode mode) throws IOException {
|
|
|
final LocatedBlock lb = createLocatedBlock(blk, pos);
|
|
|
if (mode != null) {
|
|
@@ -825,7 +825,7 @@ public class BlockManager {
|
|
|
}
|
|
|
|
|
|
/** @return a LocatedBlock for the given block */
|
|
|
- private LocatedBlock createLocatedBlock(final BlockInfoContiguous blk, final long pos
|
|
|
+ private LocatedBlock createLocatedBlock(final BlockInfo blk, final long pos
|
|
|
) throws IOException {
|
|
|
if (blk instanceof BlockInfoContiguousUnderConstruction) {
|
|
|
if (blk.isComplete()) {
|
|
@@ -873,7 +873,7 @@ public class BlockManager {
|
|
|
}
|
|
|
|
|
|
/** Create a LocatedBlocks. */
|
|
|
- public LocatedBlocks createLocatedBlocks(final BlockInfoContiguous[] blocks,
|
|
|
+ public LocatedBlocks createLocatedBlocks(final BlockInfo[] blocks,
|
|
|
final long fileSizeExcludeBlocksUnderConstruction,
|
|
|
final boolean isFileUnderConstruction, final long offset,
|
|
|
final long length, final boolean needBlockToken,
|
|
@@ -896,7 +896,7 @@ public class BlockManager {
|
|
|
final LocatedBlock lastlb;
|
|
|
final boolean isComplete;
|
|
|
if (!inSnapshot) {
|
|
|
- final BlockInfoContiguous last = blocks[blocks.length - 1];
|
|
|
+ final BlockInfo last = blocks[blocks.length - 1];
|
|
|
final long lastPos = last.isComplete()?
|
|
|
fileSizeExcludeBlocksUnderConstruction - last.getNumBytes()
|
|
|
: fileSizeExcludeBlocksUnderConstruction;
|
|
@@ -985,7 +985,7 @@ public class BlockManager {
|
|
|
/**
|
|
|
* Check if a block is replicated to at least the minimum replication.
|
|
|
*/
|
|
|
- public boolean isSufficientlyReplicated(BlockInfoContiguous b) {
|
|
|
+ public boolean isSufficientlyReplicated(BlockInfo b) {
|
|
|
// Compare against the lesser of the minReplication and number of live DNs.
|
|
|
final int replication =
|
|
|
Math.min(minReplication, getDatanodeManager().getNumLiveDataNodes());
|
|
@@ -1026,7 +1026,7 @@ public class BlockManager {
|
|
|
if(numBlocks == 0) {
|
|
|
return new BlocksWithLocations(new BlockWithLocations[0]);
|
|
|
}
|
|
|
- Iterator<BlockInfoContiguous> iter = node.getBlockIterator();
|
|
|
+ Iterator<BlockInfo> iter = node.getBlockIterator();
|
|
|
// starting from a random block
|
|
|
int startBlock = ThreadLocalRandom.current().nextInt(numBlocks);
|
|
|
// skip blocks
|
|
@@ -1035,7 +1035,7 @@ public class BlockManager {
|
|
|
}
|
|
|
List<BlockWithLocations> results = new ArrayList<BlockWithLocations>();
|
|
|
long totalSize = 0;
|
|
|
- BlockInfoContiguous curBlock;
|
|
|
+ BlockInfo curBlock;
|
|
|
while(totalSize<size && iter.hasNext()) {
|
|
|
curBlock = iter.next();
|
|
|
if(!curBlock.isComplete()) continue;
|
|
@@ -1134,7 +1134,7 @@ public class BlockManager {
|
|
|
public void findAndMarkBlockAsCorrupt(final ExtendedBlock blk,
|
|
|
final DatanodeInfo dn, String storageID, String reason) throws IOException {
|
|
|
assert namesystem.hasWriteLock();
|
|
|
- final BlockInfoContiguous storedBlock = getStoredBlock(blk.getLocalBlock());
|
|
|
+ final BlockInfo storedBlock = getStoredBlock(blk.getLocalBlock());
|
|
|
if (storedBlock == null) {
|
|
|
// Check if the replica is in the blockMap, if not
|
|
|
// ignore the request for now. This could happen when BlockScanner
|
|
@@ -1696,7 +1696,7 @@ public class BlockManager {
|
|
|
* Use the blockinfo from the blocksmap to be certain we're working
|
|
|
* with the most up-to-date block information (e.g. genstamp).
|
|
|
*/
|
|
|
- BlockInfoContiguous bi = blocksMap.getStoredBlock(timedOutItems[i]);
|
|
|
+ BlockInfo bi = blocksMap.getStoredBlock(timedOutItems[i]);
|
|
|
if (bi == null) {
|
|
|
continue;
|
|
|
}
|
|
@@ -1740,16 +1740,16 @@ public class BlockManager {
|
|
|
*/
|
|
|
private static class BlockToMarkCorrupt {
|
|
|
/** The corrupted block in a datanode. */
|
|
|
- final BlockInfoContiguous corrupted;
|
|
|
+ final BlockInfo corrupted;
|
|
|
/** The corresponding block stored in the BlockManager. */
|
|
|
- final BlockInfoContiguous stored;
|
|
|
+ final BlockInfo stored;
|
|
|
/** The reason to mark corrupt. */
|
|
|
final String reason;
|
|
|
/** The reason code to be stored */
|
|
|
final Reason reasonCode;
|
|
|
|
|
|
- BlockToMarkCorrupt(BlockInfoContiguous corrupted,
|
|
|
- BlockInfoContiguous stored, String reason,
|
|
|
+ BlockToMarkCorrupt(BlockInfo corrupted,
|
|
|
+ BlockInfo stored, String reason,
|
|
|
Reason reasonCode) {
|
|
|
Preconditions.checkNotNull(corrupted, "corrupted is null");
|
|
|
Preconditions.checkNotNull(stored, "stored is null");
|
|
@@ -1760,14 +1760,14 @@ public class BlockManager {
|
|
|
this.reasonCode = reasonCode;
|
|
|
}
|
|
|
|
|
|
- BlockToMarkCorrupt(BlockInfoContiguous stored, String reason,
|
|
|
+ BlockToMarkCorrupt(BlockInfo stored, String reason,
|
|
|
Reason reasonCode) {
|
|
|
this(stored, stored, reason, reasonCode);
|
|
|
}
|
|
|
|
|
|
- BlockToMarkCorrupt(BlockInfoContiguous stored, long gs, String reason,
|
|
|
+ BlockToMarkCorrupt(BlockInfo stored, long gs, String reason,
|
|
|
Reason reasonCode) {
|
|
|
- this(new BlockInfoContiguous(stored), stored, reason, reasonCode);
|
|
|
+ this(new BlockInfo(stored), stored, reason, reasonCode);
|
|
|
//the corrupted block in datanode has a different generation stamp
|
|
|
corrupted.setGenerationStamp(gs);
|
|
|
}
|
|
@@ -1884,10 +1884,10 @@ public class BlockManager {
|
|
|
"longer exists on the DataNode.",
|
|
|
Long.toHexString(context.getReportId()), zombie.getStorageID());
|
|
|
assert(namesystem.hasWriteLock());
|
|
|
- Iterator<BlockInfoContiguous> iter = zombie.getBlockIterator();
|
|
|
+ Iterator<BlockInfo> iter = zombie.getBlockIterator();
|
|
|
int prevBlocks = zombie.numBlocks();
|
|
|
while (iter.hasNext()) {
|
|
|
- BlockInfoContiguous block = iter.next();
|
|
|
+ BlockInfo block = iter.next();
|
|
|
// We assume that a block can be on only one storage in a DataNode.
|
|
|
// That's why we pass in the DatanodeDescriptor rather than the
|
|
|
// DatanodeStorageInfo.
|
|
@@ -1945,7 +1945,7 @@ public class BlockManager {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- BlockInfoContiguous bi = blocksMap.getStoredBlock(b);
|
|
|
+ BlockInfo bi = blocksMap.getStoredBlock(b);
|
|
|
if (bi == null) {
|
|
|
if (LOG.isDebugEnabled()) {
|
|
|
LOG.debug("BLOCK* rescanPostponedMisreplicatedBlocks: " +
|
|
@@ -1985,7 +1985,7 @@ public class BlockManager {
|
|
|
// Modify the (block-->datanode) map, according to the difference
|
|
|
// between the old and new block report.
|
|
|
//
|
|
|
- Collection<BlockInfoContiguous> toAdd = new LinkedList<BlockInfoContiguous>();
|
|
|
+ Collection<BlockInfo> toAdd = new LinkedList<BlockInfo>();
|
|
|
Collection<Block> toRemove = new TreeSet<Block>();
|
|
|
Collection<Block> toInvalidate = new LinkedList<Block>();
|
|
|
Collection<BlockToMarkCorrupt> toCorrupt = new LinkedList<BlockToMarkCorrupt>();
|
|
@@ -2002,7 +2002,7 @@ public class BlockManager {
|
|
|
removeStoredBlock(b, node);
|
|
|
}
|
|
|
int numBlocksLogged = 0;
|
|
|
- for (BlockInfoContiguous b : toAdd) {
|
|
|
+ for (BlockInfo b : toAdd) {
|
|
|
addStoredBlock(b, storageInfo, null, numBlocksLogged < maxNumBlocksToLog);
|
|
|
numBlocksLogged++;
|
|
|
}
|
|
@@ -2024,7 +2024,7 @@ public class BlockManager {
|
|
|
* Mark block replicas as corrupt except those on the storages in
|
|
|
* newStorages list.
|
|
|
*/
|
|
|
- public void markBlockReplicasAsCorrupt(BlockInfoContiguous block,
|
|
|
+ public void markBlockReplicasAsCorrupt(BlockInfo block,
|
|
|
long oldGenerationStamp, long oldNumBytes,
|
|
|
DatanodeStorageInfo[] newStorages) throws IOException {
|
|
|
assert namesystem.hasWriteLock();
|
|
@@ -2093,7 +2093,7 @@ public class BlockManager {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- BlockInfoContiguous storedBlock = blocksMap.getStoredBlock(iblk);
|
|
|
+ BlockInfo storedBlock = blocksMap.getStoredBlock(iblk);
|
|
|
// If block does not belong to any file, we are done.
|
|
|
if (storedBlock == null) continue;
|
|
|
|
|
@@ -2138,7 +2138,7 @@ public class BlockManager {
|
|
|
|
|
|
private void reportDiff(DatanodeStorageInfo storageInfo,
|
|
|
BlockListAsLongs newReport,
|
|
|
- Collection<BlockInfoContiguous> toAdd, // add to DatanodeDescriptor
|
|
|
+ Collection<BlockInfo> toAdd, // add to DatanodeDescriptor
|
|
|
Collection<Block> toRemove, // remove from DatanodeDescriptor
|
|
|
Collection<Block> toInvalidate, // should be removed from DN
|
|
|
Collection<BlockToMarkCorrupt> toCorrupt, // add to corrupt replicas list
|
|
@@ -2146,7 +2146,7 @@ public class BlockManager {
|
|
|
|
|
|
// place a delimiter in the list which separates blocks
|
|
|
// that have been reported from those that have not
|
|
|
- BlockInfoContiguous delimiter = new BlockInfoContiguous(new Block(), (short) 1);
|
|
|
+ BlockInfo delimiter = new BlockInfo(new Block(), (short) 1);
|
|
|
AddBlockResult result = storageInfo.addBlock(delimiter);
|
|
|
assert result == AddBlockResult.ADDED
|
|
|
: "Delimiting block cannot be present in the node";
|
|
@@ -2159,7 +2159,7 @@ public class BlockManager {
|
|
|
// scan the report and process newly reported blocks
|
|
|
for (BlockReportReplica iblk : newReport) {
|
|
|
ReplicaState iState = iblk.getState();
|
|
|
- BlockInfoContiguous storedBlock = processReportedBlock(storageInfo,
|
|
|
+ BlockInfo storedBlock = processReportedBlock(storageInfo,
|
|
|
iblk, iState, toAdd, toInvalidate, toCorrupt, toUC);
|
|
|
|
|
|
// move block to the head of the list
|
|
@@ -2171,7 +2171,7 @@ public class BlockManager {
|
|
|
|
|
|
// collect blocks that have not been reported
|
|
|
// all of them are next to the delimiter
|
|
|
- Iterator<BlockInfoContiguous> it =
|
|
|
+ Iterator<BlockInfo> it =
|
|
|
storageInfo.new BlockIterator(delimiter.getNext(0));
|
|
|
while(it.hasNext())
|
|
|
toRemove.add(it.next());
|
|
@@ -2209,10 +2209,10 @@ public class BlockManager {
|
|
|
* @return the up-to-date stored block, if it should be kept.
|
|
|
* Otherwise, null.
|
|
|
*/
|
|
|
- private BlockInfoContiguous processReportedBlock(
|
|
|
+ private BlockInfo processReportedBlock(
|
|
|
final DatanodeStorageInfo storageInfo,
|
|
|
final Block block, final ReplicaState reportedState,
|
|
|
- final Collection<BlockInfoContiguous> toAdd,
|
|
|
+ final Collection<BlockInfo> toAdd,
|
|
|
final Collection<Block> toInvalidate,
|
|
|
final Collection<BlockToMarkCorrupt> toCorrupt,
|
|
|
final Collection<StatefulBlockInfo> toUC) {
|
|
@@ -2233,7 +2233,7 @@ public class BlockManager {
|
|
|
}
|
|
|
|
|
|
// find block by blockId
|
|
|
- BlockInfoContiguous storedBlock = blocksMap.getStoredBlock(block);
|
|
|
+ BlockInfo storedBlock = blocksMap.getStoredBlock(block);
|
|
|
if(storedBlock == null) {
|
|
|
// If blocksMap does not contain reported block id,
|
|
|
// the replica should be removed from the data-node.
|
|
@@ -2372,7 +2372,7 @@ public class BlockManager {
|
|
|
*/
|
|
|
private BlockToMarkCorrupt checkReplicaCorrupt(
|
|
|
Block reported, ReplicaState reportedState,
|
|
|
- BlockInfoContiguous storedBlock, BlockUCState ucState,
|
|
|
+ BlockInfo storedBlock, BlockUCState ucState,
|
|
|
DatanodeDescriptor dn) {
|
|
|
switch(reportedState) {
|
|
|
case FINALIZED:
|
|
@@ -2445,7 +2445,7 @@ public class BlockManager {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private boolean isBlockUnderConstruction(BlockInfoContiguous storedBlock,
|
|
|
+ private boolean isBlockUnderConstruction(BlockInfo storedBlock,
|
|
|
BlockUCState ucState, ReplicaState reportedState) {
|
|
|
switch(reportedState) {
|
|
|
case FINALIZED:
|
|
@@ -2489,7 +2489,7 @@ public class BlockManager {
|
|
|
*
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
- private void addStoredBlockImmediate(BlockInfoContiguous storedBlock,
|
|
|
+ private void addStoredBlockImmediate(BlockInfo storedBlock,
|
|
|
DatanodeStorageInfo storageInfo)
|
|
|
throws IOException {
|
|
|
assert (storedBlock != null && namesystem.hasWriteLock());
|
|
@@ -2521,13 +2521,13 @@ public class BlockManager {
|
|
|
* needed replications if this takes care of the problem.
|
|
|
* @return the block that is stored in blockMap.
|
|
|
*/
|
|
|
- private Block addStoredBlock(final BlockInfoContiguous block,
|
|
|
+ private Block addStoredBlock(final BlockInfo block,
|
|
|
DatanodeStorageInfo storageInfo,
|
|
|
DatanodeDescriptor delNodeHint,
|
|
|
boolean logEveryBlock)
|
|
|
throws IOException {
|
|
|
assert block != null && namesystem.hasWriteLock();
|
|
|
- BlockInfoContiguous storedBlock;
|
|
|
+ BlockInfo storedBlock;
|
|
|
DatanodeDescriptor node = storageInfo.getDatanodeDescriptor();
|
|
|
if (block instanceof BlockInfoContiguousUnderConstruction) {
|
|
|
//refresh our copy in case the block got completed in another thread
|
|
@@ -2625,7 +2625,7 @@ public class BlockManager {
|
|
|
return storedBlock;
|
|
|
}
|
|
|
|
|
|
- private void logAddStoredBlock(BlockInfoContiguous storedBlock,
|
|
|
+ private void logAddStoredBlock(BlockInfo storedBlock,
|
|
|
DatanodeDescriptor node) {
|
|
|
if (!blockLog.isInfoEnabled()) {
|
|
|
return;
|
|
@@ -2653,7 +2653,7 @@ public class BlockManager {
|
|
|
*
|
|
|
* @param blk Block whose corrupt replicas need to be invalidated
|
|
|
*/
|
|
|
- private void invalidateCorruptReplicas(BlockInfoContiguous blk) {
|
|
|
+ private void invalidateCorruptReplicas(BlockInfo blk) {
|
|
|
Collection<DatanodeDescriptor> nodes = corruptReplicas.getNodes(blk);
|
|
|
boolean removedFromBlocksMap = true;
|
|
|
if (nodes == null)
|
|
@@ -2732,7 +2732,7 @@ public class BlockManager {
|
|
|
long nrInvalid = 0, nrOverReplicated = 0;
|
|
|
long nrUnderReplicated = 0, nrPostponed = 0, nrUnderConstruction = 0;
|
|
|
long startTimeMisReplicatedScan = Time.monotonicNow();
|
|
|
- Iterator<BlockInfoContiguous> blocksItr = blocksMap.getBlocks().iterator();
|
|
|
+ Iterator<BlockInfo> blocksItr = blocksMap.getBlocks().iterator();
|
|
|
long totalBlocks = blocksMap.size();
|
|
|
replicationQueuesInitProgress = 0;
|
|
|
long totalProcessed = 0;
|
|
@@ -2744,7 +2744,7 @@ public class BlockManager {
|
|
|
namesystem.writeLockInterruptibly();
|
|
|
try {
|
|
|
while (processed < numBlocksPerIteration && blocksItr.hasNext()) {
|
|
|
- BlockInfoContiguous block = blocksItr.next();
|
|
|
+ BlockInfo block = blocksItr.next();
|
|
|
MisReplicationResult res = processMisReplicatedBlock(block);
|
|
|
if (LOG.isTraceEnabled()) {
|
|
|
LOG.trace("block " + block + ": " + res);
|
|
@@ -2819,7 +2819,7 @@ public class BlockManager {
|
|
|
* appropriate queues if necessary, and returns a result code indicating
|
|
|
* what happened with it.
|
|
|
*/
|
|
|
- private MisReplicationResult processMisReplicatedBlock(BlockInfoContiguous block) {
|
|
|
+ private MisReplicationResult processMisReplicatedBlock(BlockInfo block) {
|
|
|
if (block.isDeleted()) {
|
|
|
// block does not belong to any file
|
|
|
addToInvalidates(block);
|
|
@@ -3159,7 +3159,7 @@ public class BlockManager {
|
|
|
ReplicaState reportedState, DatanodeDescriptor delHintNode)
|
|
|
throws IOException {
|
|
|
// blockReceived reports a finalized block
|
|
|
- Collection<BlockInfoContiguous> toAdd = new LinkedList<BlockInfoContiguous>();
|
|
|
+ Collection<BlockInfo> toAdd = new LinkedList<BlockInfo>();
|
|
|
Collection<Block> toInvalidate = new LinkedList<Block>();
|
|
|
Collection<BlockToMarkCorrupt> toCorrupt = new LinkedList<BlockToMarkCorrupt>();
|
|
|
Collection<StatefulBlockInfo> toUC = new LinkedList<StatefulBlockInfo>();
|
|
@@ -3176,7 +3176,7 @@ public class BlockManager {
|
|
|
addStoredBlockUnderConstruction(b, storageInfo);
|
|
|
}
|
|
|
long numBlocksLogged = 0;
|
|
|
- for (BlockInfoContiguous b : toAdd) {
|
|
|
+ for (BlockInfo b : toAdd) {
|
|
|
addStoredBlock(b, storageInfo, delHintNode, numBlocksLogged < maxNumBlocksToLog);
|
|
|
numBlocksLogged++;
|
|
|
}
|
|
@@ -3303,7 +3303,7 @@ public class BlockManager {
|
|
|
* @param b - the block being tested
|
|
|
* @return count of live nodes for this block
|
|
|
*/
|
|
|
- int countLiveNodes(BlockInfoContiguous b) {
|
|
|
+ int countLiveNodes(BlockInfo b) {
|
|
|
if (!namesystem.isInStartupSafeMode()) {
|
|
|
return countNodes(b).liveReplicas();
|
|
|
}
|
|
@@ -3382,7 +3382,7 @@ public class BlockManager {
|
|
|
return blocksMap.size();
|
|
|
}
|
|
|
|
|
|
- public DatanodeStorageInfo[] getStorages(BlockInfoContiguous block) {
|
|
|
+ public DatanodeStorageInfo[] getStorages(BlockInfo block) {
|
|
|
final DatanodeStorageInfo[] storages = new DatanodeStorageInfo[block.numNodes()];
|
|
|
int i = 0;
|
|
|
for(DatanodeStorageInfo s : blocksMap.getStorages(block)) {
|
|
@@ -3411,7 +3411,7 @@ public class BlockManager {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public BlockInfoContiguous getStoredBlock(Block block) {
|
|
|
+ public BlockInfo getStoredBlock(Block block) {
|
|
|
return blocksMap.getStoredBlock(block);
|
|
|
}
|
|
|
|
|
@@ -3464,8 +3464,8 @@ public class BlockManager {
|
|
|
* replicated.
|
|
|
*/
|
|
|
public boolean checkBlocksProperlyReplicated(
|
|
|
- String src, BlockInfoContiguous[] blocks) {
|
|
|
- for (BlockInfoContiguous b: blocks) {
|
|
|
+ String src, BlockInfo[] blocks) {
|
|
|
+ for (BlockInfo b: blocks) {
|
|
|
if (!b.isComplete()) {
|
|
|
final BlockInfoContiguousUnderConstruction uc =
|
|
|
(BlockInfoContiguousUnderConstruction)b;
|
|
@@ -3580,7 +3580,7 @@ public class BlockManager {
|
|
|
return this.neededReplications.getCorruptReplOneBlockSize();
|
|
|
}
|
|
|
|
|
|
- public BlockInfoContiguous addBlockCollection(BlockInfoContiguous block,
|
|
|
+ public BlockInfo addBlockCollection(BlockInfo block,
|
|
|
BlockCollection bc) {
|
|
|
return blocksMap.addBlockCollection(block, bc);
|
|
|
}
|
|
@@ -3820,7 +3820,7 @@ public class BlockManager {
|
|
|
|
|
|
/**
|
|
|
* A simple result enum for the result of
|
|
|
- * {@link BlockManager#processMisReplicatedBlock(BlockInfoContiguous)}.
|
|
|
+ * {@link BlockManager#processMisReplicatedBlock(BlockInfo)}.
|
|
|
*/
|
|
|
enum MisReplicationResult {
|
|
|
/** The block should be invalidated since it belongs to a deleted file. */
|