sashapolo commented on code in PR #5612:
URL: https://github.com/apache/ignite-3/pull/5612#discussion_r2039742971


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -3069,13 +3068,15 @@ public void 
setStreamerReceiverRunner(StreamerReceiverRunner runner) {
     }
 
     public Set<TableImpl> zoneTables(int zoneId) {
-        return tablesPerZone.computeIfAbsent(zoneId, id -> new HashSet<>());
+        // Using a concurrent set as a value as it can be read (and iterated 
over) without any synchronization by external callers.
+        return tablesPerZone.computeIfAbsent(zoneId, id -> 
ConcurrentHashMap.newKeySet());

Review Comment:
   > 10 calls with getOrDefault() will produce 10 instances of an empty set
   
   Well, I expected `getOrDefault` to return `Set.of()` as default, so there 
will be only a single instance. It's strange that we currently populate the map 
during a `get` operation. Or do we somewhere rely on the fact that this is a 
shared set and some data will appear in it? 



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to