ZanderXu commented on code in PR #8325:
URL: https://github.com/apache/hadoop/pull/8325#discussion_r3061658176


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/ExcessRedundancyMap.java:
##########
@@ -40,6 +42,7 @@ class ExcessRedundancyMap {
 
   private final Map<String, LightWeightHashSet<Block>> map = new HashMap<>();

Review Comment:
   ```
   private final Map<String, LightWeightHashSet<Block>> map = new 
ConcurrentHashMap<>();
   
   int getSize4Testing(String dnUuid) {
       final LightWeightHashSet<Block> set = map.get(dnUuid);
       if (set == null) {
         return 0;
       }
       synchronized (set) {
         return set.size();
       }
     }
   ```
   
   Thanks @balodesecurity for your report. How about replacing the 
ReentrantReadWriteLock with synchronization on the set?



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