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