/** @return blocks with locations. */ public BlocksWithLocations getBlocks(DatanodeInfo datanode, long size, long minBlockSize) throws IOException { return namenode.getBlocks(datanode, size, minBlockSize); }
/** @return blocks with locations. */ public BlocksWithLocations getBlocks(DatanodeInfo datanode, long size) throws IOException { return namenode.getBlocks(datanode, size); }
/** @return blocks with locations. */ public BlocksWithLocations getBlocks(DatanodeInfo datanode, long size) throws IOException { return namenode.getBlocks(datanode, size); }
@Override public GetBlocksResponseProto getBlocks(RpcController unused, GetBlocksRequestProto request) throws ServiceException { DatanodeInfo dnInfo = new DatanodeInfoBuilder() .setNodeID(PBHelperClient.convert(request.getDatanode())) .build(); BlocksWithLocations blocks; try { blocks = impl.getBlocks(dnInfo, request.getSize(), request.getMinBlockSize()); } catch (IOException e) { throw new ServiceException(e); } return GetBlocksResponseProto.newBuilder() .setBlocks(PBHelper.convert(blocks)).build(); }
private void getBlocksWithException(NamenodeProtocol namenode, DatanodeInfo datanode, long size) throws IOException { boolean getException = false; try { namenode.getBlocks(new DatanodeInfo(), 2); } catch(RemoteException e) { getException = true; assertTrue(e.getMessage().contains("IllegalArgumentException")); } assertTrue(getException); }
private long getBlockList() throws IOException { BlockWithLocations[] newBlocks = namenode.getBlocks(datanode, (long)Math.min(MAX_BLOCKS_SIZE_TO_FETCH, blocksToReceive)).getBlocks(); long bytesReceived = 0; for (BlockWithLocations blk : newBlocks) {
private long getBlockList() throws IOException { BlockWithLocations[] newBlocks = namenode.getBlocks(datanode, (long)Math.min(MAX_BLOCKS_SIZE_TO_FETCH, blocksToReceive)).getBlocks(); long bytesReceived = 0; for (BlockWithLocations blk : newBlocks) {
private void getBlocksWithException(NamenodeProtocol namenode, DatanodeInfo datanode, long size) throws IOException { boolean getException = false; try { namenode.getBlocks(DFSTestUtil.getLocalDatanodeInfo(), 2); } catch (RemoteException e) { getException = true; assertTrue(e.getClassName().contains("HadoopIllegalArgumentException")); } assertTrue(getException); }
@Override public GetBlocksResponseProto getBlocks(RpcController unused, GetBlocksRequestProto request) throws ServiceException { DatanodeInfo dnInfo = new DatanodeInfo(PBHelper.convert(request .getDatanode())); BlocksWithLocations blocks; try { blocks = impl.getBlocks(dnInfo, request.getSize()); } catch (IOException e) { throw new ServiceException(e); } return GetBlocksResponseProto.newBuilder() .setBlocks(PBHelper.convert(blocks)).build(); }
locs = namenode.getBlocks(dataNodes[0], fileLen).getBlocks(); assertEquals(locs.length, 2); assertEquals(locs[0].getDatanodes().length, 2); locs = namenode.getBlocks(dataNodes[0], DEFAULT_BLOCK_SIZE).getBlocks(); assertEquals(locs.length, 1); assertEquals(locs[0].getDatanodes().length, 2); locs = namenode.getBlocks(dataNodes[0], 1).getBlocks(); assertEquals(locs.length, 1); assertEquals(locs[0].getDatanodes().length, 2);
@Override public GetBlocksResponseProto getBlocks(RpcController unused, GetBlocksRequestProto request) throws ServiceException { DatanodeInfo dnInfo = new DatanodeInfo(PBHelper.convert(request .getDatanode())); BlocksWithLocations blocks; try { blocks = impl.getBlocks(dnInfo, request.getSize()); } catch (IOException e) { throw new ServiceException(e); } return GetBlocksResponseProto.newBuilder() .setBlocks(PBHelper.convert(blocks)).build(); }
locs = namenode.getBlocks(dataNodes[0], fileLen).getBlocks(); assertEquals(locs.length, 12); assertEquals(locs[0].getStorageIDs().length, 2); locs = namenode.getBlocks(dataNodes[0], DEFAULT_BLOCK_SIZE).getBlocks(); assertEquals(locs.length, 1); assertEquals(locs[0].getStorageIDs().length, 2); locs = namenode.getBlocks(dataNodes[0], 1).getBlocks(); assertEquals(locs.length, 1); assertEquals(locs[0].getStorageIDs().length, 2);