devmadhuu commented on code in PR #6360:
URL: https://github.com/apache/ozone/pull/6360#discussion_r1551683982


##########
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:
   Will remove DEAD_NODE fire event call and no needed, as this is async and 
cannot guarantee the cleanup before the node actually being removed. Also since 
this PR change will allow only decommissioned and DEAD nodes, so 
deadNodeHandler would have cleaned up already and decommissioning of node also 
destroy pipelines and cleanup container replicas.



-- 
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]

Reply via email to