void subtractNode(final DatanodeDescriptor node) { if (node.isInService()) { nodesInService--; } } }
void addNode(final DatanodeDescriptor node) { if (node.isInService()) { nodesInService++; } }
for (Iterator<DatanodeDescriptor> it = live.iterator(); it.hasNext();) { DatanodeDescriptor node = it.next(); if (!node.isInService()) { it.remove();
if (cur.isInService()) {
void subtractStorage(final DatanodeStorageInfo info, final DatanodeDescriptor node) { assert storageType == info.getStorageType(); capacityUsed -= info.getDfsUsed(); capacityNonDfsUsed -= info.getNonDfsUsed(); blockPoolUsed -= info.getBlockPoolUsed(); if (node.isInService()) { capacityTotal -= info.getCapacity(); capacityRemaining -= info.getRemaining(); } else { capacityTotal -= info.getDfsUsed(); } }
void addStorage(final DatanodeStorageInfo info, final DatanodeDescriptor node) { assert storageType == info.getStorageType(); capacityUsed += info.getDfsUsed(); capacityNonDfsUsed += info.getNonDfsUsed(); blockPoolUsed += info.getBlockPoolUsed(); if (node.isInService()) { capacityTotal += info.getCapacity(); capacityRemaining += info.getRemaining(); } else { capacityTotal += info.getDfsUsed(); } }
Preconditions.checkState(dn.isDecommissioned() || dn.isInService(), "Removing a node that is not yet decommissioned or in service!"); outOfServiceNodeBlocks.remove(dn);
continue; if (!datanode.isInService()) { continue;
boolean avoidStaleNodes) { if (!node.isInService()) { logNodeIsNotChosen(node, NodeNotChosenReason.NOT_IN_SERVICE); return false;
synchronized void subtract(final DatanodeDescriptor node) { xceiverCount -= node.getXceiverCount(); if (node.isInService()) { capacityUsed -= node.getDfsUsed(); capacityUsedNonDfs -= node.getNonDfsUsed(); blockPoolUsed -= node.getBlockPoolUsed(); nodesInService--; nodesInServiceXceiverCount -= node.getXceiverCount(); capacityTotal -= node.getCapacity(); capacityRemaining -= node.getRemaining(); cacheCapacity -= node.getCacheCapacity(); cacheUsed -= node.getCacheUsed(); } else if (node.isDecommissionInProgress() || node.isEnteringMaintenance()) { cacheCapacity -= node.getCacheCapacity(); cacheUsed -= node.getCacheUsed(); } Set<StorageType> storageTypes = new HashSet<>(); for (DatanodeStorageInfo storageInfo : node.getStorageInfos()) { if (storageInfo.getState() != DatanodeStorage.State.FAILED) { statsMap.subtractStorage(storageInfo, node); storageTypes.add(storageInfo.getStorageType()); } } for (StorageType storageType : storageTypes) { statsMap.subtractNode(storageType, node); } }
synchronized void add(final DatanodeDescriptor node) { xceiverCount += node.getXceiverCount(); if (node.isInService()) { capacityUsed += node.getDfsUsed(); capacityUsedNonDfs += node.getNonDfsUsed(); blockPoolUsed += node.getBlockPoolUsed(); nodesInService++; nodesInServiceXceiverCount += node.getXceiverCount(); capacityTotal += node.getCapacity(); capacityRemaining += node.getRemaining(); cacheCapacity += node.getCacheCapacity(); cacheUsed += node.getCacheUsed(); } else if (node.isDecommissionInProgress() || node.isEnteringMaintenance()) { cacheCapacity += node.getCacheCapacity(); cacheUsed += node.getCacheUsed(); } Set<StorageType> storageTypes = new HashSet<>(); for (DatanodeStorageInfo storageInfo : node.getStorageInfos()) { if (storageInfo.getState() != DatanodeStorage.State.FAILED) { statsMap.addStorage(storageInfo, node); storageTypes.add(storageInfo.getStorageType()); } } for (StorageType storageType : storageTypes) { statsMap.addNode(storageType, node); } }