/** * Count the number of dead datanode. * * @param nn namenode * @param json JSON string */ private static void getDeadNodeCount(String json, NamenodeStatus nn) throws IOException { Map<String, Map<String, Object>> nodeMap = getNodeMap(json); if (nodeMap == null || nodeMap.isEmpty()) { return; } nn.deadDatanodeCount = nodeMap.size(); for (Entry<String, Map<String, Object>> entry : nodeMap.entrySet()) { Map<String, Object> innerMap = entry.getValue(); if (innerMap != null && !innerMap.isEmpty()) { if (((Boolean) innerMap.get("decommissioned")) .booleanValue() == true) { nn.deadDecomCount++; } } } }
/** * Count the number of dead datanode. * * @param nn namenode * @param json JSON string */ private static void getDeadNodeCount(String json, NamenodeStatus nn) throws IOException { Map<String, Map<String, Object>> nodeMap = getNodeMap(json); if (nodeMap == null || nodeMap.isEmpty()) { return; } nn.deadDatanodeCount = nodeMap.size(); for (Entry<String, Map<String, Object>> entry : nodeMap.entrySet()) { Map<String, Object> innerMap = entry.getValue(); if (innerMap != null && !innerMap.isEmpty()) { if (((Boolean) innerMap.get("decommissioned")) .booleanValue() == true) { nn.deadDecomCount++; } } } }
/** * Get the decommisioning datanode information. * * @param dataNodeStatusMap map with key being datanode, value being an * inner map (key:namenode, value:decommisionning state). * @param host datanode * @param json String */ private static void getDecommissionNodeStatus( Map<String, Map<String, String>> dataNodeStatusMap, String host, String json) throws IOException { Map<String, Map<String, Object>> nodeMap = getNodeMap(json); if (nodeMap == null || nodeMap.isEmpty()) { return; } List<String> decomming = new ArrayList<String>(); for (Entry<String, Map<String, Object>> entry : nodeMap.entrySet()) { String dn = entry.getKey(); decomming.add(dn); // nn-status Map<String, String> nnStatus = new HashMap<String, String>(); if (dataNodeStatusMap.containsKey(dn)) { nnStatus = dataNodeStatusMap.get(dn); } nnStatus.put(host, AdminStates.DECOMMISSION_INPROGRESS.toString()); // dn-nn-status dataNodeStatusMap.put(dn, nnStatus); } } }
Map<String, Map<String, String>> statusMap, String host, String json) throws IOException { Map<String, Map<String, Object>> nodeMap = getNodeMap(json); if (nodeMap == null || nodeMap.isEmpty()) { return;
Map<String, Map<String, String>> statusMap, String namenodeAddr, String json) throws IOException { Map<String, Map<String, Object>> nodeMap = getNodeMap(json); if (nodeMap != null && !nodeMap.isEmpty()) { List<String> liveDecommed = new ArrayList<String>();
Map<String, Map<String, String>> statusMap, String address, String json) throws IOException { Map<String, Map<String, Object>> nodeMap = getNodeMap(json); if (nodeMap == null || nodeMap.isEmpty()) { return;
Map<String, Map<String, String>> statusMap, String host, String json) throws IOException { Map<String, Map<String, Object>> nodeMap = getNodeMap(json); if (nodeMap == null || nodeMap.isEmpty()) { return;
Map<String, Map<String, String>> statusMap, String namenodeHost, String json) throws IOException { Map<String, Map<String, Object>> nodeMap = getNodeMap(json); if (nodeMap != null && !nodeMap.isEmpty()) { List<String> liveDecommed = new ArrayList<String>();
Map<String, Map<String, String>> statusMap, String namenodeHost, String json) throws IOException { Map<String, Map<String, Object>> nodeMap = getNodeMap(json); if (nodeMap != null && !nodeMap.isEmpty()) { List<String> liveDecommed = new ArrayList<String>();
throws IOException { Map<String, Map<String, Object>> nodeMap = getNodeMap(json); if (nodeMap == null || nodeMap.isEmpty()) { return;
/** * Count the number of dead datanode based on the JSON string returned from * JMX call. * * @param nn namenode * @param json JSON string returned from JMX call */ private static void getDeadNodeCount(String json, NamenodeStatus nn) throws IOException { Map<String, Map<String, Object>> nodeMap = getNodeMap(json); if (nodeMap == null || nodeMap.isEmpty()) { return; } nn.deadDatanodeCount = nodeMap.size(); for (Entry<String, Map<String, Object>> entry : nodeMap.entrySet()) { Map<String, Object> innerMap = entry.getValue(); if (innerMap != null && !innerMap.isEmpty()) { if (((Boolean) innerMap.get("decommissioned")) .booleanValue() == true) { nn.deadDecomCount++; } if (((Boolean) innerMap.get("excluded")) .booleanValue() == true) { nn.deadExcludeCount++; } } } }
/** * Get the decommisioning datanode information. * * @param dataNodeStatusMap map with key being datanode, value being an * inner map (key:namenode, value:decommisionning state). * @param host datanode * @param json String */ private static void getDecommissionNodeStatus( Map<String, Map<String, String>> dataNodeStatusMap, String host, String json) throws IOException { Map<String, Map<String, Object>> nodeMap = getNodeMap(json); if (nodeMap == null || nodeMap.isEmpty()) { return; } List<String> decomming = new ArrayList<String>(); for (Entry<String, Map<String, Object>> entry : nodeMap.entrySet()) { String dn = entry.getKey(); decomming.add(dn); // nn-status Map<String, String> nnStatus = new HashMap<String, String>(); if (dataNodeStatusMap.containsKey(dn)) { nnStatus = dataNodeStatusMap.get(dn); } nnStatus.put(host, AdminStates.DECOMMISSION_INPROGRESS.toString()); // dn-nn-status dataNodeStatusMap.put(dn, nnStatus); } } }
/** * We process the JSON string returned from JMX connection to get the * decommisioning datanode information. * * @param dataNodeStatusMap map with key being datanode, value being an * inner map (key:namenode, value:decommisionning state). * @param address * @param json JSON string returned from JMX connection */ private static void getDecommissionNodeStatus( Map<String, Map<String, String>> dataNodeStatusMap, String address, String json) throws IOException { Map<String, Map<String, Object>> nodeMap = getNodeMap(json); if (nodeMap == null || nodeMap.isEmpty()) { return; } List<String> decomming = new ArrayList<String>(); for (Entry<String, Map<String, Object>> entry : nodeMap.entrySet()) { String dn = entry.getKey(); decomming.add(dn); // nn-status Map<String, String> nnStatus = new HashMap<String, String>(); if (dataNodeStatusMap.containsKey(dn)) { nnStatus = dataNodeStatusMap.get(dn); } nnStatus.put(address, AdminStates.DECOMMISSION_INPROGRESS.toString()); // dn-nn-status dataNodeStatusMap.put(dn, nnStatus); } }
/** * Get the number of live datanodes. * * @param json JSON string that contains live node status. * @param nn namenode status to return information in */ private static void getLiveNodeCount(String json, NamenodeStatus nn) throws IOException { // Map of datanode host to (map of attribute name to value) Map<String, Map<String, Object>> nodeMap = getNodeMap(json); if (nodeMap == null || nodeMap.isEmpty()) { return; } nn.liveDatanodeCount = nodeMap.size(); for (Entry<String, Map<String, Object>> entry : nodeMap.entrySet()) { // Inner map of attribute name to value Map<String, Object> innerMap = entry.getValue(); if (innerMap != null) { if (innerMap.get("adminState") .equals(AdminStates.DECOMMISSIONED.toString())) { nn.liveDecomCount++; } } } }
/** * Get the number of live datanodes. * * @param json JSON string that contains live node status. * @param nn namenode status to return information in */ private static void getLiveNodeCount(String json, NamenodeStatus nn) throws IOException { // Map of datanode host to (map of attribute name to value) Map<String, Map<String, Object>> nodeMap = getNodeMap(json); if (nodeMap == null || nodeMap.isEmpty()) { return; } nn.liveDatanodeCount = nodeMap.size(); for (Entry<String, Map<String, Object>> entry : nodeMap.entrySet()) { // Inner map of attribute name to value Map<String, Object> innerMap = entry.getValue(); if (innerMap != null) { if (innerMap.get("adminState") .equals(AdminStates.DECOMMISSIONED.toString())) { nn.liveDecomCount++; } } } }