You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/01/13 16:23:26 UTC

[GitHub] [ozone] umamaheswararao commented on a change in pull request #2973: HDDS-6021: EC: Client side exclude nodes list should expire after certain time period or based on the list size.

umamaheswararao commented on a change in pull request #2973:
URL: https://github.com/apache/ozone/pull/2973#discussion_r784118402



##########
File path: hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/container/common/helpers/ExcludeList.java
##########
@@ -22,43 +22,67 @@
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.scm.container.ContainerID;
 import org.apache.hadoop.hdds.scm.pipeline.PipelineID;
+import org.apache.hadoop.util.Daemon;
 
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 
+import static org.apache.hadoop.util.Time.monotonicNow;
+
 /**
  * This class contains set of dns and containers which ozone client provides
  * to be handed over to SCM when block allocation request comes.
  */
 public class ExcludeList {
 
-  private final Set<DatanodeDetails> datanodes;
+  private final Map<DatanodeDetails, Long> datanodes;
   private final Set<ContainerID> containerIds;
   private final Set<PipelineID> pipelineIds;
+  private Daemon excludeNodesCleaner;
+  private boolean autoCleanerRunning;
 
 
   public ExcludeList() {
-    datanodes = new HashSet<>();
+    datanodes = new HashMap<>();
     containerIds = new HashSet<>();
     pipelineIds = new HashSet<>();
   }
 
+  public void startAutoExcludeNodesCleaner(long expiryTime,
+      long recheckInterval) {
+    excludeNodesCleaner =
+        new Daemon(new ExcludeNodesCleaner(expiryTime, recheckInterval));
+    excludeNodesCleaner.start();
+  }
+
+  public void stopAutoExcludeNodesCleaner() {
+    if (excludeNodesCleaner != null) {
+      autoCleanerRunning = false;
+      excludeNodesCleaner.interrupt();
+    }
+  }
+
   public Set<ContainerID> getContainerIds() {
     return containerIds;
   }
 
   public Set<DatanodeDetails> getDatanodes() {
-    return datanodes;
+    return datanodes.keySet();

Review comment:
       Good point. I have removed background thread now.
   




-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org