/** * Verifies that the block is associated with a file that has a lease. * Increments, logs and then returns the stamp */ synchronized long nextGenerationStampForBlock(Block block) throws IOException { BlockInfo storedBlock = blocksMap.getStoredBlock(block); if (storedBlock == null) { String msg = block + " is already commited, storedBlock == null."; LOG.info(msg); throw new IOException(msg); } INodeFile fileINode = storedBlock.getINode(); if (!fileINode.isUnderConstruction()) { String msg = block + " is already commited, !fileINode.isUnderConstruction()."; LOG.info(msg); throw new IOException(msg); } if (!((INodeFileUnderConstruction)fileINode).setLastRecoveryTime(now())) { String msg = block + " is beening recovered, ignoring this request."; LOG.info(msg); throw new IOException(msg); } return nextGenerationStamp(); }
boolean initialBlockReport) { assert (hasWriteLock()); BlockInfo storedBlock = blocksMap.getStoredBlock(block); if (storedBlock == null) {
/** * Add a block to the file. Returns a reference to the added block. */ Block addBlock(String path, INode[] inodes, Block block) throws IOException { waitForReady(); synchronized (rootDir) { INodeFile fileNode = (INodeFile) inodes[inodes.length-1]; // check quota limits and updated space consumed updateCount(inodes, inodes.length-1, 0, fileNode.getPreferredBlockSize()*fileNode.getReplication()); // associate the new list of blocks with this file namesystem.blocksMap.addINode(block, fileNode); BlockInfo blockInfo = namesystem.blocksMap.getStoredBlock(block); fileNode.addBlock(blockInfo); NameNode.stateChangeLog.debug("DIR* FSDirectory.addFile: " + path + " with " + block + " block is added to the in-memory " + "file system"); } return block; }
BlockInfo storedBlock = blocksMap.getStoredBlock(blockWithWildcardGenstamp); if (storedBlock == null) { String msg = block + " is already commited, storedBlock == null.";
if (blocks != null && blocks.length > 0) { Block last = blocks[blocks.length-1]; BlockInfo storedBlock = blocksMap.getStoredBlock(last); if (file.getPreferredBlockSize() > storedBlock.getNumBytes()) { long fileLength = file.computeContentSummary().getLength();
final BlockInfo oldblockinfo = blocksMap.getStoredBlock(blockWithWildcardGenstamp); if (oldblockinfo == null) { throw new IOException("Block (=" + lastblock + ") not found");
iblk.set(newReport.getBlockId(i), newReport.getBlockLen(i), newReport.getBlockGenStamp(i)); BlockInfo storedBlock = blocksMap.getStoredBlock(iblk); if(storedBlock == null) {
+ ", deleteBlock=" + deleteblock + ")"); final BlockInfo oldblockinfo = blocksMap.getStoredBlock(lastblock); if (oldblockinfo == null) { throw new IOException("Block (=" + lastblock + ") not found");
BlockInfo storedBlock = blocksMap.getStoredBlock(block); INodeFile fileINode = storedBlock == null ? null : storedBlock.getINode(); if (fileINode != null &&
if (blocks != null && blocks.length > 0) { Block last = blocks[blocks.length - 1]; BlockInfo storedBlock = blocksMap.getStoredBlock(last); if (file.getPreferredBlockSize() > storedBlock.getNumBytes()) { long fileLength = file.computeContentSummary().getLength();
final BlockInfo storedBlockInfo = blocksMap.getStoredBlock(blk); if (storedBlockInfo == null) {
iblk.set(newReport.getBlockId(i), newReport.getBlockLen(i), newReport.getBlockGenStamp(i)); BlockInfo storedBlock = blocksMap.getStoredBlock(iblk); if(storedBlock == null) { storedBlock = blocksMap.getStoredBlock(oblk); if (storedBlock != null && storedBlock.getINode() != null && (storedBlock.getGenerationStamp() <= iblk.getGenerationStamp() ||
DatanodeDescriptor node, DatanodeDescriptor delNodeHint) { BlockInfo storedBlock = blocksMap.getStoredBlock(block); if(storedBlock == null || storedBlock.getINode() == null) { storedBlock = blocksMap.getStoredBlock(block); //extra look up! if (storedBlock == null) { LOG.warn("Block " + block +