You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "shishkovilja (via GitHub)" <gi...@apache.org> on 2026/04/01 09:39:08 UTC

Re: [PR] IGNITE-28403 Remove IgniteDhtPartitionCountersMap [ignite]

shishkovilja commented on code in PR #12958:
URL: https://github.com/apache/ignite/pull/12958#discussion_r3020951792


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java:
##########
@@ -319,7 +325,9 @@ public void addLostPartitions(int grpId, Collection<Integer> lostParts) {
      * @return Partition update counters.
      */
     public CachePartitionFullCountersMap partitionUpdateCounters(int grpId) {
-        return partCntrs == null ? null : partCntrs.get(grpId);
+        synchronized (mux) {

Review Comment:
   ```suggestion
           synchronized (partCntrs) {
   ```
   
   ?



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java:
##########
@@ -278,10 +281,13 @@ public void addFullPartitionsMap(int grpId, GridDhtPartitionFullMap fullMap, @Nu
      * @param cntrMap Partition update counters.
      */
     public void addPartitionUpdateCounters(int grpId, CachePartitionFullCountersMap cntrMap) {
-        if (partCntrs == null)
-            partCntrs = new IgniteDhtPartitionCountersMap();
+        synchronized (mux) {
+            if (partCntrs == null)
+                partCntrs = new HashMap<>();
 
-        partCntrs.putIfAbsent(grpId, cntrMap);
+            if (!partCntrs.containsKey(grpId))

Review Comment:
   Any reason not to use `putIfAbsent`?



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsFullMessage.java:
##########
@@ -278,10 +281,13 @@ public void addFullPartitionsMap(int grpId, GridDhtPartitionFullMap fullMap, @Nu
      * @param cntrMap Partition update counters.
      */
     public void addPartitionUpdateCounters(int grpId, CachePartitionFullCountersMap cntrMap) {
-        if (partCntrs == null)
-            partCntrs = new IgniteDhtPartitionCountersMap();
+        synchronized (mux) {

Review Comment:
   May be like below?
   ```suggestion
           synchronized (partCntrs) {
   ```



-- 
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-unsubscribe@ignite.apache.org

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