rich7420 commented on code in PR #11688:
URL: https://github.com/apache/ozone/pull/11688#discussion_r4706025874
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/NodeStateManager.java:
##########
@@ -871,6 +886,15 @@ private void updateClusterMap(DatanodeInfo node,
NodeStatus oldStatus, NodeStatu
}
} else if (oldStatus.isDead()) {
clusterMap.add(node);
+ } else {
+ return;
+ }
+ // If the node registered again in the meantime, the change above can
undo the topology update of updateNode.
+ final DatanodeInfo current = nodeStateMap.getNodeInfo(node.getID());
+ if (current != node && !current.getNodeStatus().isDead()) {
Review Comment:
Could a test also cover a re-registration while a DEAD node is being added
back to the topology? Limiting this repair to `newStatus.isDead()` still passed
the 29 related tests.
##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java:
##########
@@ -407,6 +413,72 @@ private static DatanodeDetails
nodeInTopology(NetworkTopology clusterMap,
return (DatanodeDetails) clusterMap.getNode(node.getNetworkFullPath());
}
+ /**
+ * A datanode can register again with new ports just when the health check
marks it DEAD and removes it from the
+ * network topology. Whichever of the two starts first, the other one can
run in the middle of it, and the datanode
+ * still ends up HEALTHY and in the topology with its new ports.
+ */
+ @ParameterizedTest
+ @ValueSource(booleans = {true, false})
+ public void testRegisterWhileMarkedDeadKeepsNodeInTopology(boolean
removalFirst) throws Exception {
Review Comment:
Could the removal-first and registration-first cases get their own names
(two methods, or named arguments)? Both currently fail as `…(boolean)[n]` at
line 474.
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/NodeStateManager.java:
##########
@@ -847,9 +857,13 @@ private void updateNodeState(DatanodeInfo node,
Predicate<Long> condition,
NodeState newHealthState = nodeHealthSM.
getNextState(status.getHealth(), lifeCycleEvent);
NodeStatus newStatus =
- nodeStateMap.updateNodeHealthState(node.getID(), newHealthState);
- updateClusterMap(node, status, newStatus);
- fireHealthStateEvent(newStatus.getHealth(), node);
+ nodeStateMap.updateNodeHealthState(node, status.getHealth(),
newHealthState);
+ // null means the node changed after this health check read it, for
example it registered again.
+ // The next health check decides again.
+ if (newStatus != null) {
Review Comment:
Could a `TestNodeStateManager` case make `updateNodeHealthState` return null
here? With this guard removed the 29 related tests still passed, and a forced
skip then threw an NPE out of `checkNodesHealth`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]