/** @return the number of blocks with out-of-service-only replicas */ public synchronized int getOutOfServiceOnlyReplicas() { if (!isDecommissionInProgress() && !isEnteringMaintenance()) { return 0; } return outOfServiceOnlyReplicas; } /** @return the number of under-replicated blocks in open files */
/** @return the number of under-replicated blocks in open files */ public synchronized int getUnderReplicatedInOpenFiles() { if (!isDecommissionInProgress() && !isEnteringMaintenance()) { return 0; } return underReplicatedBlocksInOpenFiles; } /** @return the collection of under-replicated blocks in open files */
/** Set start time */ public synchronized void setStartTime(long time) { if (!isDecommissionInProgress() && !isEnteringMaintenance()) { return; } startTime = time; } /** @return start time */
synchronized void set(int lowRedundancyBlocksInOpenFiles, LightWeightHashSet<Long> underRepInOpenFiles, int underRepBlocks, int outOfServiceOnlyRep) { if (!isDecommissionInProgress() && !isEnteringMaintenance()) { return; } underReplicatedOpenFiles = underRepInOpenFiles; underReplicatedBlocks = underRepBlocks; underReplicatedBlocksInOpenFiles = lowRedundancyBlocksInOpenFiles; outOfServiceOnlyReplicas = outOfServiceOnlyRep; }
/** @return the number of under-replicated blocks */ public synchronized int getUnderReplicatedBlocks() { if (!isDecommissionInProgress() && !isEnteringMaintenance()) { return 0; } return underReplicatedBlocks; } /** @return the number of blocks with out-of-service-only replicas */
/** @return start time */ public synchronized long getStartTime() { if (!isDecommissionInProgress() && !isEnteringMaintenance()) { return 0; } return startTime; } } // End of class LeavingServiceStatus
/** @return the collection of under-replicated blocks in open files */ public synchronized LightWeightHashSet<Long> getOpenFiles() { if (!isDecommissionInProgress() && !isEnteringMaintenance()) { return new LightWeightLinkedSet<>(); } return underReplicatedOpenFiles; } /** Set start time */
private List<Integer> findLeavingServiceSources() { List<Integer> srcIndices = new ArrayList<>(); for (int i = 0; i < getSrcNodes().length; i++) { if (getSrcNodes()[i].isDecommissionInProgress() || (getSrcNodes()[i].isEnteringMaintenance() && getSrcNodes()[i].isAlive())) { srcIndices.add(i); } } return srcIndices; } }
/** * Start maintenance of the specified datanode. * @param node */ @VisibleForTesting public void startMaintenance(DatanodeDescriptor node, long maintenanceExpireTimeInMS) { // Even if the node is already in maintenance, we still need to adjust // the expiration time. node.setMaintenanceExpireTimeInMS(maintenanceExpireTimeInMS); if (!node.isMaintenance()) { // Update DN stats maintained by HeartbeatManager hbManager.startMaintenance(node); // hbManager.startMaintenance will set dead node to IN_MAINTENANCE. if (node.isEnteringMaintenance()) { for (DatanodeStorageInfo storage : node.getStorageInfos()) { LOG.info("Starting maintenance of {} {} with {} blocks", node, storage, storage.numBlocks()); } node.getLeavingServiceStatus().setStartTime(monotonicNow()); } // Track the node regardless whether it is ENTERING_MAINTENANCE or // IN_MAINTENANCE to support maintenance expiration. pendingNodes.add(node); } else { LOG.trace("startMaintenance: Node {} in {}, nothing to do.", node, node.getAdminState()); } }
sb.append("DECOMMISSIONING)"); } else if (this.showMaintenanceState && dnDesc.isEnteringMaintenance()) { sb.append("ENTERING MAINTENANCE)"); } else if (this.showMaintenanceState &&
} else if (dn.isDecommissionInProgress()) { out.print(DECOMMISSIONING_STATUS); } else if (this.showMaintenanceState && dn.isEnteringMaintenance()) { out.print(ENTERING_MAINTENANCE_STATUS); } else if (this.showMaintenanceState && dn.isInMaintenance()) {
+ srcNode.isDecommissionInProgress() + ", Is current datanode entering maintenance: " + srcNode.isEnteringMaintenance());
&& (!node.isDecommissionInProgress() && !node.isEnteringMaintenance()) && node.getNumberOfBlocksToBeReplicated() >= maxReplicationStreams) { continue; // already reached replication limit
final boolean isDead = isDatanodeDead(dn); final boolean isDecommissioning = dn.isDecommissionInProgress(); final boolean isEnteringMaintenance = dn.isEnteringMaintenance(); final boolean isInMaintenance = dn.isInMaintenance();
setDecommissioned(dn); toRemove.add(dn); } else if (dn.isEnteringMaintenance()) {
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); } }
|| (d.isEnteringMaintenance() && !d.isAlive())) { continue;