final long requiredSize = blockSize * HdfsServerConstants.MIN_BLOCKS_FOR_WRITE; final long scheduledSize = blockSize * getBlocksScheduled(t); long remaining = 0; DatanodeStorageInfo storage = null;
.put("used", node.getDfsUsed()) .put("remaining", node.getRemaining()) .put("blockScheduled", node.getBlocksScheduled()) .put("blockPoolUsed", node.getBlockPoolUsed()) .put("blockPoolUsedPercent", node.getBlockPoolUsedPercent())
.put("used", node.getDfsUsed()) .put("remaining", node.getRemaining()) .put("blockScheduled", node.getBlocksScheduled()) .put("blockPoolUsed", node.getBlockPoolUsed()) .put("blockPoolUsedPercent", node.getBlockPoolUsedPercent())
@Test public void testBlocksScheduledCounter() throws IOException { cluster = new MiniDFSCluster.Builder(new HdfsConfiguration()).build(); cluster.waitActive(); fs = cluster.getFileSystem(); //open a file an write a few bytes: FSDataOutputStream out = fs.create(new Path("/testBlockScheduledCounter")); for (int i=0; i<1024; i++) { out.write(i); } // flush to make sure a block is allocated. out.hflush(); ArrayList<DatanodeDescriptor> dnList = new ArrayList<DatanodeDescriptor>(); final DatanodeManager dm = cluster.getNamesystem().getBlockManager( ).getDatanodeManager(); dm.fetchDatanodes(dnList, dnList, false); DatanodeDescriptor dn = dnList.get(0); assertEquals(1, dn.getBlocksScheduled()); // close the file and the counter should go to zero. out.close(); assertEquals(0, dn.getBlocksScheduled()); } }
.put("used", node.getDfsUsed()) .put("remaining", node.getRemaining()) .put("blockScheduled", node.getBlocksScheduled()) .put("blockPoolUsed", node.getBlockPoolUsed()) .put("blockPoolUsedPercent", node.getBlockPoolUsedPercent())
final long scheduledSize = blockSize * node.getBlocksScheduled(storage.getStorageType()); final long remaining = node.getRemaining(storage.getStorageType(), requiredSize);
final long scheduledSize = blockSize * node.getBlocksScheduled(storage.getStorageType()); final long remaining = node.getRemaining(storage.getStorageType(), requiredSize);