Skip to content

Commit e67b2ea

Browse files
committed
HDFS-17644:Add log when a node selection is rejected by BPP UpgradeDomain
1 parent e4b0700 commit e67b2ea

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,16 @@ protected StringBuilder initialValue() {
8080
private static final BlockPlacementStatus ONE_RACK_PLACEMENT =
8181
new BlockPlacementStatusDefault(1, 1, 1);
8282

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

9394
private final String text;
9495

@@ -980,7 +981,7 @@ private static void logNodeIsNotChosen(DatanodeDescriptor node,
980981
logNodeIsNotChosen(node, reason, null);
981982
}
982983

983-
private static void logNodeIsNotChosen(DatanodeDescriptor node,
984+
protected static void logNodeIsNotChosen(DatanodeDescriptor node,
984985
NodeNotChosenReason reason, String reasonDetails) {
985986
assert reason != null;
986987
if (LOG.isDebugEnabled()) {

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyWithUpgradeDomain.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ protected boolean isGoodDatanode(DatanodeDescriptor node,
7474
Set<String> upgradeDomains = getUpgradeDomains(results);
7575
if (upgradeDomains.contains(node.getUpgradeDomain())) {
7676
isGoodTarget = false;
77+
logNodeIsNotChosen(node, NodeNotChosenReason.NODE_NOT_CONFORM_TO_UD,
78+
"(The node's upgrade domain: " + node.getUpgradeDomain() +
79+
" is already chosen)");
7780
}
7881
}
7982
}

0 commit comments

Comments
 (0)