Skip to content

Commit

Permalink
HDFS-17644:Add log when a node selection is rejected by BPP UpgradeDo…
Browse files Browse the repository at this point in the history
…main (#7109)
  • Loading branch information
li-leyang authored Oct 26, 2024
1 parent 0b37553 commit eb1e303
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,16 @@ protected StringBuilder initialValue() {
private static final BlockPlacementStatus ONE_RACK_PLACEMENT =
new BlockPlacementStatusDefault(1, 1, 1);

private enum NodeNotChosenReason {
protected enum NodeNotChosenReason {
NOT_IN_SERVICE("the node is not in service"),
NODE_STALE("the node is stale"),
NODE_TOO_BUSY("the node is too busy"),
NODE_TOO_BUSY_BY_VOLUME("the node is too busy based on volume load"),
TOO_MANY_NODES_ON_RACK("the rack has too many chosen nodes"),
NOT_ENOUGH_STORAGE_SPACE("not enough storage space to place the block"),
NO_REQUIRED_STORAGE_TYPE("required storage types are unavailable"),
NODE_SLOW("the node is too slow");
NODE_SLOW("the node is too slow"),
NODE_NOT_CONFORM_TO_UD("the node doesn't conform to upgrade domain policy");

private final String text;

Expand Down Expand Up @@ -980,7 +981,7 @@ private static void logNodeIsNotChosen(DatanodeDescriptor node,
logNodeIsNotChosen(node, reason, null);
}

private static void logNodeIsNotChosen(DatanodeDescriptor node,
protected static void logNodeIsNotChosen(DatanodeDescriptor node,
NodeNotChosenReason reason, String reasonDetails) {
assert reason != null;
if (LOG.isDebugEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ protected boolean isGoodDatanode(DatanodeDescriptor node,
Set<String> upgradeDomains = getUpgradeDomains(results);
if (upgradeDomains.contains(node.getUpgradeDomain())) {
isGoodTarget = false;
logNodeIsNotChosen(node, NodeNotChosenReason.NODE_NOT_CONFORM_TO_UD,
"(The node's upgrade domain: " + node.getUpgradeDomain() +
" is already chosen)");
}
}
}
Expand Down

0 comments on commit eb1e303

Please sign in to comment.