siddhantsangwan commented on code in PR #7008: URL: https://github.com/apache/ozone/pull/7008#discussion_r1853815232
########## hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/safemode/ContainerSafeModeRule.java: ########## @@ -50,10 +57,14 @@ public class ContainerSafeModeRule extends // Required cutoff % for containers with at least 1 reported replica. private double safeModeCutoff; // Containers read from scm db (excluding containers in ALLOCATED state). - private Map<Long, ContainerInfo> containerMap; - private double maxContainer; - - private AtomicLong containerWithMinReplicas = new AtomicLong(0); + private Map<Long, Integer> ratisContainerMinReplicaMap; + private Map<Long, Set<UUID>> ratisContainerDNsMap; + private Map<Long, Integer> ecContainerMinReplicaMap; Review Comment: We don't need to maintain this mapping either, as far as I can tell. Whenever we have the container id and need the replication factor of that container, we can use a container manager method to get it. That'll be a constant time (O(1)) lookup for container manager. ########## hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/safemode/ContainerSafeModeRule.java: ########## @@ -50,10 +57,14 @@ public class ContainerSafeModeRule extends // Required cutoff % for containers with at least 1 reported replica. private double safeModeCutoff; // Containers read from scm db (excluding containers in ALLOCATED state). - private Map<Long, ContainerInfo> containerMap; - private double maxContainer; - - private AtomicLong containerWithMinReplicas = new AtomicLong(0); + private Map<Long, Integer> ratisContainerMinReplicaMap; Review Comment: This map is not needed as far as I can tell. It can just be a Set of Ratis container ids (long), since the min replica count for ratis containers is always 1. ########## hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/safemode/ContainerSafeModeRule.java: ########## @@ -50,10 +57,14 @@ public class ContainerSafeModeRule extends // Required cutoff % for containers with at least 1 reported replica. private double safeModeCutoff; // Containers read from scm db (excluding containers in ALLOCATED state). - private Map<Long, ContainerInfo> containerMap; - private double maxContainer; - - private AtomicLong containerWithMinReplicas = new AtomicLong(0); + private Map<Long, Integer> ratisContainerMinReplicaMap; + private Map<Long, Set<UUID>> ratisContainerDNsMap; Review Comment: Why maintain a mapping for ratis containers? If we use the set of container id that I mentioned above, we can simply remove a container id from the set when a datanode reports having a replica of that container. -- 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]
