@Override //NameNodeMXBean public int getDistinctVersionCount() { return blockManager.getDatanodeManager().getDatanodesSoftwareVersions() .size(); }
@Override public String getSlowPeersReport() { return namesystem.getBlockManager().getDatanodeManager() .getSlowPeersReport(); }
/** * @return true if both block and datanode threshold are met else false. */ private boolean areThresholdsMet() { assert namesystem.hasWriteLock(); int datanodeNum = blockManager.getDatanodeManager().getNumLiveDataNodes(); synchronized (this) { return blockSafe >= blockThreshold && datanodeNum >= datanodeThreshold; } }
@Override //NameNodeStatusMXBean public String getSlowDisksReport() { return namesystem.getBlockManager().getDatanodeManager() .getSlowDisksReport(); }
@Override // FSNamesystemMBean @Metric({"NumDecommissioningDataNodes", "Number of datanodes in decommissioning state"}) public int getNumDecommissioningDataNodes() { return getBlockManager().getDatanodeManager().getDecommissioningNodes() .size(); }
@Override // FSNamesystemMBean @Metric({"NumEnteringMaintenanceDataNodes", "Number of Datanodes that are entering the maintenance state"}) public int getNumEnteringMaintenanceDataNodes() { return getBlockManager().getDatanodeManager().getEnteringMaintenanceNodes() .size(); }
/** * Check if a block is replicated to at least the minimum replication. */ public boolean isSufficientlyReplicated(BlockInfo b) { // Compare against the lesser of the minReplication and number of live DNs. final int replication = Math.min(minReplication, getDatanodeManager().getNumLiveDataNodes()); return countNodes(b).liveReplicas() >= replication; }
int getNumberOfDatanodes(DatanodeReportType type) { readLock(); try { return getBlockManager().getDatanodeManager().getDatanodeListForReport( type).size(); } finally { readUnlock("getNumberOfDatanodes"); } }
@Override // FSNamesystemMBean @Metric({"NumDecomDeadDataNodes", "Number of datanodes which have been decommissioned and are now dead"}) public int getNumDecomDeadDataNodes() { final List<DatanodeDescriptor> dead = new ArrayList<DatanodeDescriptor>(); getBlockManager().getDatanodeManager().fetchDatanodes(null, dead, false); int deadDecommissioned = 0; for (DatanodeDescriptor node : dead) { deadDecommissioned += node.isDecommissioned() ? 1 : 0; } return deadDecommissioned; }
/** * Storages are marked as "content stale" after NN restart or fails over and * before NN receives the first Heartbeat followed by the first Blockreport. */ @Override // FSNamesystemMBean @Metric({"NumStaleStorages", "Number of storages marked as content stale"}) public int getNumStaleStorages() { return getBlockManager().getDatanodeManager().getNumStaleStorages(); }
@Override // FSNamesystemMBean @Metric({"NumInMaintenanceDeadDataNodes", "Number of dead Datanodes which are in maintenance state"}) public int getNumInMaintenanceDeadDataNodes() { final List<DatanodeDescriptor> dead = new ArrayList<DatanodeDescriptor>(); getBlockManager().getDatanodeManager().fetchDatanodes(null, dead, true); int deadInMaintenance = 0; for (DatanodeDescriptor node : dead) { deadInMaintenance += node.isInMaintenance() ? 1 : 0; } return deadInMaintenance; }
@Override // FSNamesystemMBean @Metric({"NumLiveDataNodes", "Number of datanodes which are currently live"}) public int getNumLiveDataNodes() { return getBlockManager().getDatanodeManager().getNumLiveDataNodes(); }
@Override // FSNamesystemMBean @Metric({"VolumeFailuresTotal", "Total number of volume failures across all Datanodes"}) public int getVolumeFailuresTotal() { List<DatanodeDescriptor> live = new ArrayList<DatanodeDescriptor>(); getBlockManager().getDatanodeManager().fetchDatanodes(live, null, false); int volumeFailuresTotal = 0; for (DatanodeDescriptor node: live) { volumeFailuresTotal += node.getVolumeFailures(); } return volumeFailuresTotal; }
@Override // FSNamesystemMBean @Metric({"StaleDataNodes", "Number of datanodes marked stale due to delayed heartbeat"}) public int getNumStaleDataNodes() { return getBlockManager().getDatanodeManager().getNumStaleNodes(); }
@Override // FSNamesystemMBean @Metric({"NumDeadDataNodes", "Number of datanodes which are currently dead"}) public int getNumDeadDataNodes() { return getBlockManager().getDatanodeManager().getNumDeadDataNodes(); }
@Override // FSNamesystemMBean @Metric({"NumDecomLiveDataNodes", "Number of datanodes which have been decommissioned and are now live"}) public int getNumDecomLiveDataNodes() { final List<DatanodeDescriptor> live = new ArrayList<DatanodeDescriptor>(); getBlockManager().getDatanodeManager().fetchDatanodes(live, null, false); int liveDecommissioned = 0; for (DatanodeDescriptor node : live) { liveDecommissioned += node.isDecommissioned() ? 1 : 0; } return liveDecommissioned; }
@Override // FSNamesystemMBean @Metric({"NumInMaintenanceLiveDataNodes", "Number of live Datanodes which are in maintenance state"}) public int getNumInMaintenanceLiveDataNodes() { final List<DatanodeDescriptor> live = new ArrayList<DatanodeDescriptor>(); getBlockManager().getDatanodeManager().fetchDatanodes(live, null, true); int liveInMaintenance = 0; for (DatanodeDescriptor node : live) { liveInMaintenance += node.isInMaintenance() ? 1 : 0; } return liveInMaintenance; }
void setBalancerBandwidth(long bandwidth) throws IOException { String operationName = "setBalancerBandwidth"; checkOperation(OperationCategory.WRITE); checkSuperuserPrivilege(operationName); getBlockManager().getDatanodeManager().setBalancerBandwidth(bandwidth); logAuditEvent(true, operationName, null); }
void refreshNodes() throws IOException { String operationName = "refreshNodes"; checkOperation(OperationCategory.UNCHECKED); checkSuperuserPrivilege(operationName); getBlockManager().getDatanodeManager().refreshNodes(new HdfsConfiguration()); logAuditEvent(true, operationName, null); }
@Override public Object run() throws Exception { NameNode nn = NameNodeHttpServer.getNameNodeFromContext(context); final FSNamesystem namesystem = nn.getNamesystem(); final BlockManager bm = namesystem.getBlockManager(); final int totalDatanodes = namesystem.getNumberOfDatanodes(DatanodeReportType.LIVE); new NamenodeFsck(conf, nn, bm.getDatanodeManager().getNetworkTopology(), pmap, out, totalDatanodes, remoteAddress).fsck(); return null; } });