adoroszlai commented on a change in pull request #2897:
URL: https://github.com/apache/ozone/pull/2897#discussion_r794004283



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerAttribute.java
##########
@@ -189,7 +189,11 @@ public boolean remove(T key, ContainerID value) {
     Preconditions.checkNotNull(key);
 
     if (this.attributeMap.containsKey(key)) {
-      return Collections.unmodifiableNavigableSet(this.attributeMap.get(key));
+      NavigableSet<ContainerID> returneSet = new TreeSet<>();
+      TreeSet<ContainerID> tmpSet = (TreeSet<ContainerID>)

Review comment:
       Is the cast necessary?
   
   ```suggestion
         NavigableSet<ContainerID> tmpSet =
   ```

##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/states/ContainerAttribute.java
##########
@@ -189,7 +189,11 @@ public boolean remove(T key, ContainerID value) {
     Preconditions.checkNotNull(key);
 
     if (this.attributeMap.containsKey(key)) {
-      return Collections.unmodifiableNavigableSet(this.attributeMap.get(key));
+      NavigableSet<ContainerID> returneSet = new TreeSet<>();

Review comment:
       > One thing is to build the metric of state count will be expensive.
   
   We could avoid copy on read by making `ContainerAttribute` store 
`ConcurrentSkipListSet` instead of `TreeSet`.




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