private static void logNodeIsNotChosen(DatanodeDescriptor node, NodeNotChosenReason reason) { logNodeIsNotChosen(node, reason, null); }
/** * Choose a good storage of given storage type from datanode, and add it to * the result list. * * @param dnd datanode descriptor * @param blockSize requested block size * @param results the result storages * @param storageType requested storage type * @return the chosen datanode storage */ DatanodeStorageInfo chooseStorage4Block(DatanodeDescriptor dnd, long blockSize, List<DatanodeStorageInfo> results, StorageType storageType) { DatanodeStorageInfo storage = dnd.chooseStorage4Block(storageType, blockSize); if (storage != null) { results.add(storage); } else { logNodeIsNotChosen(dnd, NodeNotChosenReason.NOT_ENOUGH_STORAGE_SPACE, " for storage type " + storageType); } return storage; }
/** * Determine if a datanode should be chosen based on current workload. * * @param node The target datanode * @return Return true if the datanode should be excluded, otherwise false */ boolean excludeNodeByLoad(DatanodeDescriptor node){ final double maxLoad = considerLoadFactor * stats.getInServiceXceiverAverage(); final int nodeLoad = node.getXceiverCount(); if ((nodeLoad > maxLoad) && (maxLoad > 0)) { logNodeIsNotChosen(node, NodeNotChosenReason.NODE_TOO_BUSY, "(load: " + nodeLoad + " > " + maxLoad + ")"); return true; } return false; }
logNodeIsNotChosen(node, NodeNotChosenReason.NOT_IN_SERVICE); return false; logNodeIsNotChosen(node, NodeNotChosenReason.NODE_STALE); return false; logNodeIsNotChosen(node, NodeNotChosenReason.TOO_MANY_NODES_ON_RACK); return false;
StorageType requiredStorageType) { if (storage.getStorageType() != requiredStorageType) { logNodeIsNotChosen(storage, "storage types do not match," + " where the required storage type is " + requiredStorageType); return false; logNodeIsNotChosen(storage, "storage is read-only"); return false; logNodeIsNotChosen(storage, "storage has failed"); return false; logNodeIsNotChosen(storage, "the node is (being) decommissioned "); return false; logNodeIsNotChosen(storage, "the node is stale "); return false; requiredSize); if (requiredSize > remaining - scheduledSize) { logNodeIsNotChosen(storage, "the node does not have enough " + storage.getStorageType() + " space" + " (required=" + requiredSize final int nodeLoad = node.getXceiverCount(); if (nodeLoad > maxLoad) { logNodeIsNotChosen(storage, "the node is too busy (load: " + nodeLoad + " > " + maxLoad + ") "); return false;
StorageType requiredStorageType) { if (storage.getStorageType() != requiredStorageType) { logNodeIsNotChosen(storage, "storage types do not match," + " where the required storage type is " + requiredStorageType); return false; logNodeIsNotChosen(storage, "storage is read-only"); return false; logNodeIsNotChosen(storage, "storage has failed"); return false; logNodeIsNotChosen(storage, "the node is (being) decommissioned "); return false; logNodeIsNotChosen(storage, "the node is stale "); return false; requiredSize); if (requiredSize > remaining - scheduledSize) { logNodeIsNotChosen(storage, "the node does not have enough " + storage.getStorageType() + " space" + " (required=" + requiredSize final int nodeLoad = node.getXceiverCount(); if (nodeLoad > maxLoad) { logNodeIsNotChosen(storage, "the node is too busy (load: " + nodeLoad + " > " + maxLoad + ") "); return false;