InputStream getBlockInputStream(ExtendedBlock block, long seekOffset) throws IOException { return datanode.data.getBlockInputStream(block, seekOffset); }
FileInputStream[] requestShortCircuitFdsForRead(final ExtendedBlock blk, final Token<BlockTokenIdentifier> token, int maxVersion) throws ShortCircuitFdsUnsupportedException, ShortCircuitFdsVersionException, IOException { if (fileDescriptorPassingDisabledReason != null) { throw new ShortCircuitFdsUnsupportedException( fileDescriptorPassingDisabledReason); } int blkVersion = CURRENT_BLOCK_FORMAT_VERSION; if (maxVersion < blkVersion) { throw new ShortCircuitFdsVersionException("Your client is too old " + "to read this block! Its format version is " + blkVersion + ", but the highest format version you can read is " + maxVersion); } metrics.incrBlocksGetLocalPathInfo(); FileInputStream fis[] = new FileInputStream[2]; try { fis[0] = (FileInputStream)data.getBlockInputStream(blk, 0); fis[1] = DatanodeUtil.getMetaDataInputStream(blk, data); } catch (ClassCastException e) { LOG.debug("requestShortCircuitFdsForRead failed", e); throw new ShortCircuitFdsUnsupportedException("This DataNode's " + "FsDatasetSpi does not support short-circuit local reads"); } return fis; }
DataNode.LOG.debug("replica=" + replica); blockIn = datanode.data.getBlockInputStream(block, offset); // seek to offset ris = new ReplicaInputStreams( blockIn, checksumIn, volumeRef, fileIoProvider);
if (partialLength > 0) { byte[] buf = new byte[partialLength]; final InputStream blockIn = datanode.data.getBlockInputStream(block, requestLength - partialLength); try {
if (partialLength > 0) { byte[] buf = new byte[partialLength]; final InputStream blockIn = datanode.data.getBlockInputStream(block, requestLength - partialLength); try {
FileInputStream[] requestShortCircuitFdsForRead(final ExtendedBlock blk, final Token<BlockTokenIdentifier> token, int maxVersion) throws ShortCircuitFdsUnsupportedException, ShortCircuitFdsVersionException, IOException { if (fileDescriptorPassingDisabledReason != null) { throw new ShortCircuitFdsUnsupportedException( fileDescriptorPassingDisabledReason); } int blkVersion = CURRENT_BLOCK_FORMAT_VERSION; if (maxVersion < blkVersion) { throw new ShortCircuitFdsVersionException("Your client is too old " + "to read this block! Its format version is " + blkVersion + ", but the highest format version you can read is " + maxVersion); } metrics.incrBlocksGetLocalPathInfo(); FileInputStream fis[] = new FileInputStream[2]; try { fis[0] = (FileInputStream)data.getBlockInputStream(blk, 0); fis[1] = DatanodeUtil.getMetaDataInputStream(blk, data); } catch (ClassCastException e) { LOG.debug("requestShortCircuitFdsForRead failed", e); throw new ShortCircuitFdsUnsupportedException("This DataNode's " + "FsDatasetSpi does not support short-circuit local reads"); } return fis; }
FileInputStream[] requestShortCircuitFdsForRead(final ExtendedBlock blk, final Token<BlockTokenIdentifier> token, int maxVersion) throws ShortCircuitFdsUnsupportedException, ShortCircuitFdsVersionException, IOException { if (fileDescriptorPassingDisabledReason != null) { throw new ShortCircuitFdsUnsupportedException( fileDescriptorPassingDisabledReason); } int blkVersion = CURRENT_BLOCK_FORMAT_VERSION; if (maxVersion < blkVersion) { throw new ShortCircuitFdsVersionException("Your client is too old " + "to read this block! Its format version is " + blkVersion + ", but the highest format version you can read is " + maxVersion); } metrics.incrBlocksGetLocalPathInfo(); FileInputStream fis[] = new FileInputStream[2]; try { fis[0] = (FileInputStream)data.getBlockInputStream(blk, 0); fis[1] = DatanodeUtil.getMetaDataInputStream(blk, data); } catch (ClassCastException e) { LOG.debug("requestShortCircuitFdsForRead failed", e); throw new ShortCircuitFdsUnsupportedException("This DataNode's " + "FsDatasetSpi does not support short-circuit local reads"); } return fis; }
DataNode.LOG.debug("replica=" + replica); blockIn = datanode.data.getBlockInputStream(block, offset); // seek to offset if (blockIn instanceof FileInputStream) { blockInFd = ((FileInputStream)blockIn).getFD();
private static long[] getBlockSizes(HdfsBlockLocation[] locs) throws Exception { long[] sizes = new long[locs.length]; for (int i=0; i<locs.length; i++) { HdfsBlockLocation loc = locs[i]; String bpid = loc.getLocatedBlock().getBlock().getBlockPoolId(); Block block = loc.getLocatedBlock().getBlock().getLocalBlock(); ExtendedBlock extBlock = new ExtendedBlock(bpid, block); FileInputStream blockInputStream = null; FileChannel blockChannel = null; try { blockInputStream = (FileInputStream)fsd.getBlockInputStream(extBlock, 0); blockChannel = blockInputStream.getChannel(); sizes[i] = blockChannel.size(); } finally { IOUtils.cleanup(LOG, blockChannel, blockInputStream); } } return sizes; }
DataNode.LOG.debug("replica=" + replica); blockIn = datanode.data.getBlockInputStream(block, offset); // seek to offset if (blockIn instanceof FileInputStream) { blockInFd = ((FileInputStream)blockIn).getFD();