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/27 21:16:34 UTC

[GitHub] [ozone] adoroszlai commented on a change in pull request #2897: HDDS 6060 Error getting metrics from source SCMContainerMetrics

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