devmadhuu commented on code in PR #6360:
URL: https://github.com/apache/ozone/pull/6360#discussion_r1550202113
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java:
##########
@@ -1642,4 +1642,34 @@ private ReentrantReadWriteLock.WriteLock writeLock() {
private ReentrantReadWriteLock.ReadLock readLock() {
return lock.readLock();
}
+
+ /**
+ * This API allows removal of only DECOMMISSIONED and DEAD nodes from
NodeManager data structures and cleanup memory.
+ * This API call is having a pre-condition before removal of node like
following resources to be removed:
+ * --- pipelines
+ * --- containers
+ * --- network topology
+ * --- or any other cache related to node context in SCM
+ *
+ * @param datanodeDetails
+ * @throws NodeNotFoundException
+ */
+ @Override
+ public void removeNode(DatanodeDetails datanodeDetails) throws
NodeNotFoundException, IOException {
+ writeLock().lock();
+ try {
+ NodeStatus nodeStatus = this.getNodeStatus(datanodeDetails);
+ if (datanodeDetails.isDecommissioned() || nodeStatus.isDead()) {
+ if (clusterMap.contains(datanodeDetails)) {
+ clusterMap.remove(datanodeDetails);
+ }
+ nodeStateManager.removeNode(datanodeDetails);
+ removeFromDnsToUuidMap(datanodeDetails.getUuid(),
datanodeDetails.getIpAddress());
+ commandQueue.removeCommand(datanodeDetails.getUuid());
+ scmNodeEventPublisher.fireEvent(SCMEvents.DEAD_NODE, datanodeDetails);
Review Comment:
Node state sync doesn't happen from SCM in Recon, it is being updated based
on DN heartbeat (stale and dead interval) and inherited DeadNodeHandler code of
SCM gets called first in onMessage of ReconDeadNodeHandler, then recon updates
the node operational state in ReconNodeManager class. I think , Recon don't
sync node state from SCM.
--
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]