rich7420 commented on code in PR #11688:
URL: https://github.com/apache/ozone/pull/11688#discussion_r4706025861
##########
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 test hit this skip? Without the guard the tests I ran still pass,
but a real skip NPEs.
##########
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:
Is the recovery side tested (re-register while a DEAD node comes back)?
Limiting this to DEAD still passed.
##########
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:
Maybe name the two cases (removal first / registration first)? Right now
both fail as `(boolean)[n]`.
--
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]