@VisibleForTesting BlockInfo getStoredBlock(Block block) { return blockManager.getStoredBlock(block); }
/** * Returns whether the given block is one pointed-to by a file. */ private boolean isValidBlock(Block b) { BlockInfo bi = blockManager.getStoredBlock(b); return bi != null && bi.getBlockCollectionId() != INodeId.INVALID_INODE_ID; } }
/** * @param b A block object whose id is set to the starting point for check * @return true if any ID in the range * {id, id+HdfsConstants.MAX_BLOCKS_IN_GROUP} is pointed-to by a stored * block. */ private boolean hasValidBlockInRange(Block b) { final long id = b.getBlockId(); for (int i = 0; i < MAX_BLOCKS_IN_GROUP; i++) { b.setBlockId(id + i); if (blockManager.getStoredBlock(b) != null) { return true; } } return false; } }
private void removeStoredBlock(DatanodeStorageInfo storageInfo, Block block, DatanodeDescriptor node) { if (shouldPostponeBlocksFromFuture && isGenStampInFuture(block)) { queueReportedBlock(storageInfo, block, null, QUEUE_REASON_FUTURE_GENSTAMP); return; } removeStoredBlock(getStoredBlock(block), node); }
it.remove(); BlockInfo bi = getStoredBlock(b); if (bi == null) { LOG.debug("BLOCK* rescanPostponedMisreplicatedBlocks: " +
BlockInfo blockInfo = blockManager.getStoredBlock(block); if (blockInfo == null || blockInfo.isDeleted()) { out.println("Block "+ blockId +" " + NONEXISTENT_STATUS);
private void processQueuedMessages(Iterable<ReportedBlockInfo> rbis) throws IOException { for (ReportedBlockInfo rbi : rbis) { LOG.debug("Processing previouly queued message {}", rbi); if (rbi.getReportedState() == null) { // This is a DELETE_BLOCK request DatanodeStorageInfo storageInfo = rbi.getStorageInfo(); removeStoredBlock(getStoredBlock(rbi.getBlock()), storageInfo.getDatanodeDescriptor()); } else { processAndHandleReportedBlock(rbi.getStorageInfo(), rbi.getBlock(), rbi.getReportedState(), null); } } }
BlockInfo storedBlock = getStoredBlock(block); if (storedBlock != null && block.getGenerationStamp() == storedBlock.getGenerationStamp()) {
BlockInfo blockInfo = blockManager.getStoredBlock(b); if (blockInfo == null || blockInfo.isDeleted()) { LOG.info("Cannot find block info for block " + b);
CachedBlock cblock = it.next(); BlockInfo blockInfo = blockManager. getStoredBlock(new Block(cblock.getBlockId())); if (blockInfo == null) { getStoredBlock(new Block(cblock.getBlockId())); String reason = findReasonForNotCaching(cblock, blockInfo); int neededCached = 0;
assert namesystem.hasWriteLock(); final Block reportedBlock = blk.getLocalBlock(); final BlockInfo storedBlock = getStoredBlock(reportedBlock); if (storedBlock == null) {
chooseSourceDatanodes(getStoredBlock(block), containingNodes, containingLiveReplicasNodes, numReplicas, new LinkedList<Byte>(), LowRedundancyBlocks.LEVEL);
getStoredBlock(new Block(cachedBlock.getBlockId())); if (blockInfo == null) { LOG.debug("Block {}: can't add new cached replicas," + CachedBlock cBlock = it.next(); BlockInfo info = blockManager.getStoredBlock(new Block(cBlock.getBlockId())); if (info != null) { pendingBytes -= info.getNumBytes(); CachedBlock cBlock = it.next(); BlockInfo info = blockManager.getStoredBlock(new Block(cBlock.getBlockId())); if (info != null) { pendingBytes += info.getNumBytes();
final BlockInfo storedBlock = blockManager.getStoredBlock( block.getLocalBlock()); final int minReplication = blockManager.getMinStorageNum(storedBlock); ExtendedBlock block = lastBlock.getBlock(); String blkName = block.toString(); BlockInfo storedBlock = blockManager.getStoredBlock( block.getLocalBlock()); DatanodeStorageInfo[] storages = storedBlock
/** * Decrement number of safe blocks if the current block is contiguous * and it has just fallen below minimal replication or * if the current block is striped and its actual data blocks has just fallen * below the number of data units specified by erasure coding policy. * If safe mode is not currently on, this is a no-op. */ synchronized void decrementSafeBlockCount(BlockInfo b) { assert namesystem.hasWriteLock(); if (status == BMSafeModeStatus.OFF) { return; } final int safeNumberOfNodes = b.isStriped() ? ((BlockInfoStriped)b).getRealDataBlockNum() : safeReplication; BlockInfo storedBlock = blockManager.getStoredBlock(b); if (storedBlock.isComplete() && blockManager.countNodes(b).liveReplicas() == safeNumberOfNodes - 1) { this.blockSafe--; assert blockSafe >= 0; checkSafeMode(); } }
BlockInfo storedBlock = getStoredBlock(block); if(storedBlock == null) {
if (!block.isComplete()) { storedBlock = getStoredBlock(block); } else { storedBlock = block;
BlockInfo storedBlock = getStoredBlock(iblk);
for(int j = 0, e = bpl.size(); j < e; ++j) { Block blk = PBHelperClient.convert(bpl.get(j)); BlockInfo storedBlock = bm.getStoredBlock(blk); if(storedBlock == null) { storedBlock = (BlockInfoContiguous) fsn.getBlockManager()
return null; assert lastBlock == getStoredBlock(lastBlock) : "last block of the file is not in blocksMap";