sumitagrawl commented on code in PR #9953:
URL: https://github.com/apache/ozone/pull/9953#discussion_r2986498618


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/safemode/AbstractContainerSafeModeRule.java:
##########
@@ -135,14 +181,48 @@ public double getCurrentContainerThreshold() {
 
   @Override
   public synchronized void refresh(boolean forceRefresh) {
-    if (forceRefresh || !validate()) {
+    if (forceRefresh) {
       initializeRule();
     }
+    if (!validate()) {
+      // iterate through open containers and check if any of them have moved 
to closed state
+      for(ContainerID containerID : openContainers.keySet()) {
+        try {
+        ContainerInfo containerInfo = 
containerManager.getContainer(containerID);
+        if (isClosed(containerInfo)) {
+          addContainer(containerInfo);
+          openContainers.remove(containerID);
+          closedContainers.put(containerID, containerID);

Review Comment:
   If DN is already reported, increment the reported count



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/safemode/AbstractContainerSafeModeRule.java:
##########
@@ -135,14 +181,48 @@ public double getCurrentContainerThreshold() {
 
   @Override
   public synchronized void refresh(boolean forceRefresh) {
-    if (forceRefresh || !validate()) {
+    if (forceRefresh) {
       initializeRule();
     }
+    if (!validate()) {
+      // iterate through open containers and check if any of them have moved 
to closed state
+      for(ContainerID containerID : openContainers.keySet()) {
+        try {
+        ContainerInfo containerInfo = 
containerManager.getContainer(containerID);

Review Comment:
   for open container loop, closed container loop, target is if present in 
closed container or not-present in closed container from containerManager 
respectively. So every time, it performs containerManager.get(), but if we can 
get as list of closedState, that can resolve this. Can compare performance in 
both case.



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