int size = clusterMap.getNumOfLeaves(); if (size != 0) { avgLoad = (double)fs.getTotalLoad()/size;
private static void checkClusterHealth( int numOfLiveNodes, FSNamesystem namesystem, double expectedTotalLoad, int expectedInServiceNodes, double expectedInServiceLoad) { assertEquals(numOfLiveNodes, namesystem.getNumLiveDataNodes()); assertEquals(expectedInServiceNodes, getNumDNInService(namesystem)); assertEquals(expectedTotalLoad, namesystem.getTotalLoad(), EPSILON); if (expectedInServiceNodes != 0) { assertEquals(expectedInServiceLoad / expectedInServiceNodes, getInServiceXceiverAverage(namesystem), EPSILON); } else { assertEquals(0.0, getInServiceXceiverAverage(namesystem), EPSILON); } }
private void verifyStats(NameNode namenode, FSNamesystem fsn, DatanodeInfo info, DataNode node, boolean decommissioning) throws InterruptedException, IOException { // Do the stats check over 10 heartbeats for (int i = 0; i < 10; i++) { long[] newStats = namenode.getRpcServer().getStats(); // For decommissioning nodes, ensure capacity of the DN is no longer // counted. Only used space of the DN is counted in cluster capacity assertEquals(newStats[0], decommissioning ? info.getDfsUsed() : info.getCapacity()); // Ensure cluster used capacity is counted for both normal and // decommissioning nodes assertEquals(newStats[1], info.getDfsUsed()); // For decommissioning nodes, remaining space from the DN is not counted assertEquals(newStats[2], decommissioning ? 0 : info.getRemaining()); // Ensure transceiver count is same as that DN assertEquals(fsn.getTotalLoad(), info.getXceiverCount()); DataNodeTestUtils.triggerHeartbeat(node); } }
capacityRemainingGB.pushMetric(metricsRecord); totalLoad.set(fsNameSystem.getTotalLoad()); totalLoad.pushMetric(metricsRecord);
capacityRemainingGB.set(roundBytesToGBytes(fsNameSystem. getCapacityRemaining())); totalLoad.set(fsNameSystem.getTotalLoad()); corruptBlocks.set((int)fsNameSystem.getCorruptReplicaBlocks()); excessBlocks.set((int)fsNameSystem.getExcessBlocks());