siddhantsangwan commented on code in PR #6974:
URL: https://github.com/apache/ozone/pull/6974#discussion_r1719609285


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ScmClient.java:
##########
@@ -113,12 +118,27 @@ public Map<Long, Pipeline> 
getContainerLocations(Iterable<Long> containerIds,
     }
     try {
       Map<Long, Pipeline> result = containerLocationCache.getAll(containerIds);
-      // Don't keep empty pipelines in the cache.
-      List<Long> emptyPipelines = result.entrySet().stream()
-          .filter(e -> e.getValue().isEmpty())
+      // Don't keep empty pipelines or insufficient EC pipelines in the cache.
+      List<Long> uncachePipelines = result.entrySet().stream()
+          .filter(e -> {
+            Pipeline pipeline = e.getValue();
+            // filter empty pipelines
+            if (pipeline.isEmpty()) {
+              return true;
+            }
+            // filter insufficient EC pipelines
+            ReplicationConfig repConfig = pipeline.getReplicationConfig();
+            if (repConfig instanceof ECReplicationConfig) {
+              int d = ((ECReplicationConfig) repConfig).getData();
+              Set<Integer> dataIndexes = EC_DATA_INDEXES.computeIfAbsent(d, k 
->
+                  IntStream.rangeClosed(1, 
d).boxed().collect(Collectors.toSet()));

Review Comment:
   Here, we're writing to the map in a multi-threaded context. We should either 
use a concurrent hash map or change this logic such that it's read-only.



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