/** * @inheritDoc */ public int getSafemodeTime() { return myMetrics.safeModeTime.get(); }
.valueOf((int) this.requests.getPreviousIntervalValue())); sb = Strings.appendKeyValue(sb, "numberOfOnlineRegions", Integer.valueOf(this.regions.get())); sb = Strings.appendKeyValue(sb, "numberOfStores", Integer.valueOf(this.stores.get())); sb = Strings.appendKeyValue(sb, "numberOfStorefiles", Integer.valueOf(this.storefiles.get())); sb = Strings.appendKeyValue(sb, this.storefileIndexSizeMB.getName(), Integer.valueOf(this.storefileIndexSizeMB.get())); sb = Strings.appendKeyValue(sb, "rootIndexSizeKB", Integer.valueOf(this.rootIndexSizeKB.get())); sb = Strings.appendKeyValue(sb, "totalStaticIndexSizeKB", Integer.valueOf(this.totalStaticIndexSizeKB.get())); sb = Strings.appendKeyValue(sb, "totalStaticBloomSizeKB", Integer.valueOf(this.totalStaticBloomSizeKB.get())); sb = Strings.appendKeyValue(sb, this.memstoreSizeMB.getName(), Integer.valueOf(this.memstoreSizeMB.get())); sb = Strings.appendKeyValue(sb, "mbInMemoryWithoutWAL", Integer.valueOf(this.mbInMemoryWithoutWAL.get())); Long.valueOf(this.readRequestsCount.get())); sb = Strings.appendKeyValue(sb, "writeRequestsCount", Long.valueOf(this.writeRequestsCount.get())); sb = Strings.appendKeyValue(sb, "compactionQueueSize", Integer.valueOf(this.compactionQueueSize.get())); sb = Strings.appendKeyValue(sb, "flushQueueSize", Integer.valueOf(this.flushQueueSize.get())); Long.valueOf(this.blockCacheMissCount.get()));
/** * @inheritDoc */ public int getFSImageLoadTime() { return myMetrics.fsImageLoadTime.get(); }
return ((MetricsIntValue) o).get(); else if (o instanceof MetricsLongValue) return ((MetricsLongValue) o).get();
/** Corrupt a block and ensure metrics reflects it */ public void testCorruptBlock() throws Exception { // Create a file with single block with two replicas final Path file = getTestPath("testCorruptBlock"); createFile(file, 100, (short)2); // Corrupt first replica of the block LocatedBlock block = NameNodeAdapter.getBlockLocations( cluster.getNameNode(), file.toString(), 0, 1).get(0); namesystem.markBlockAsCorrupt(block.getBlock(), block.getLocations()[0]); updateMetrics(); assertEquals(1, metrics.corruptBlocks.get()); assertEquals(1, metrics.pendingReplicationBlocks.get()); assertEquals(1, metrics.scheduledReplicationBlocks.get()); fs.delete(file, true); updateMetrics(); assertEquals(0, metrics.corruptBlocks.get()); assertEquals(0, metrics.pendingReplicationBlocks.get()); assertEquals(0, metrics.scheduledReplicationBlocks.get()); }
return ((MetricsIntValue) o).get(); else if (o instanceof MetricsLongValue) return ((MetricsLongValue) o).get();
return ((MetricsIntValue) o).get(); else if (o instanceof MetricsLongValue) return ((MetricsLongValue) o).get();
return ((MetricsIntValue) o).get(); else if (o instanceof MetricsLongValue) return ((MetricsLongValue) o).get();
return ((MetricsIntValue) o).get(); else if (o instanceof MetricsLongValue) return ((MetricsLongValue) o).get();
/** Create excess blocks by reducing the replication factor for * for a file and ensure metrics reflects it */ public void testExcessBlocks() throws Exception { Path file = getTestPath("testExcessBlocks"); createFile(file, 100, (short)2); int totalBlocks = 1; namesystem.setReplication(file.toString(), (short)1); updateMetrics(); assertEquals(totalBlocks, metrics.excessBlocks.get()); fs.delete(file, true); }
return ((MetricsIntValue)o).get(); } else if (o instanceof MetricsLongValue) { return ((MetricsLongValue)o).get();
/** Test to ensure metrics reflects missing blocks */ public void testMissingBlock() throws Exception { // Create a file with single block with two replicas Path file = getTestPath("testMissingBlocks"); createFile(file, 100, (short)1); // Corrupt the only replica of the block to result in a missing block LocatedBlock block = NameNodeAdapter.getBlockLocations( cluster.getNameNode(), file.toString(), 0, 1).get(0); namesystem.markBlockAsCorrupt(block.getBlock(), block.getLocations()[0]); updateMetrics(); assertEquals(1, metrics.underReplicatedBlocks.get()); assertEquals(1, metrics.missingBlocks.get()); fs.delete(file, true); updateMetrics(); assertEquals(0, metrics.underReplicatedBlocks.get()); }
/** * test JMX connection to NameNode.. * @throws Exception */ public void testNameNode() throws Exception { int numDatanodes = 2; cluster = new MiniDFSCluster.Builder(config).numDataNodes(numDatanodes).build(); cluster.waitActive(); writeFile(cluster.getFileSystem(), new Path("/test1"), 2); JMXGet jmx = new JMXGet(); jmx.init(); //get some data from different sources int blocks_corrupted = NameNode.getNameNodeMetrics(). numBlocksCorrupted.get(); assertEquals(Integer.parseInt( jmx.getValue("NumLiveDataNodes")), 2); assertEquals(Integer.parseInt( jmx.getValue("BlocksCorrupted")), blocks_corrupted); assertEquals(Integer.parseInt( jmx.getValue("NumOpenConnections")), 0); cluster.shutdown(); }
int blockCapacity = namesystem.getBlockCapacity(); updateMetrics(); assertEquals(blockCapacity, metrics.blockCapacity.get()); assertEquals(filesTotal, metrics.filesTotal.get()); assertEquals(blockCount, metrics.blocksTotal.get()); assertEquals(blockCapacity, metrics.blockCapacity.get()); fs.delete(file, true); assertEquals(filesTotal, metrics.filesTotal.get()); assertEquals(0, metrics.blocksTotal.get()); assertEquals(0, metrics.pendingDeletionBlocks.get());
,DATANODE_COUNT,metrics.totalLoad.get());