wernerdv commented on code in PR #12523:
URL: https://github.com/apache/ignite/pull/12523#discussion_r2556528201


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsSingleMessage.java:
##########
@@ -239,29 +257,54 @@ public Map<Integer, Long> partitionSizes(int grpId) {
         if (partsSizes == null)
             return Collections.emptyMap();
 
-        return partsSizes.getOrDefault(grpId, Collections.emptyMap());
+        PartitionLongMap sizesMap = partsSizes.get(grpId);
+
+        return sizesMap != null ? F.emptyIfNull(sizesMap.partitions()) : 
Collections.emptyMap();
     }
 
     /**
-     * @param grpId Cache group ID.
-     * @param cntrMap Partition history counters.
+     * @return Partitions sizes.
      */
-    public void partitionHistoryCounters(int grpId, Map<Integer, Long> 
cntrMap) {
-        if (cntrMap.isEmpty())
-            return;
+    public Map<Integer, PartitionLongMap> partitionSizesMap() {
+        return partsSizes;
+    }
 
-        if (partHistCntrs == null)
-            partHistCntrs = new HashMap<>();
+    /**
+     * @param partsSizes Partitions sizes.
+     */
+    public void partitionSizesMap(Map<Integer, PartitionLongMap> partsSizes) {
+        this.partsSizes = partsSizes;
+    }
 
-        partHistCntrs.put(grpId, cntrMap);
+    /**
+     * @return Partitions history reservation counters.
+     */
+    public Map<Integer, PartitionLongMap> partitionHistoryCountersMap() {
+        return partHistCntrs;
+    }
+
+    /**
+     * @param partHistCntrs Partitions history reservation counters.
+     */
+    public void partitionHistoryCountersMap(Map<Integer, PartitionLongMap> 
partHistCntrs) {
+        this.partHistCntrs = partHistCntrs;
     }
 
     /**
      * @param cntrMap Partition history counters.
      */
     void partitionHistoryCounters(Map<Integer, Map<Integer, Long>> cntrMap) {
-        for (Map.Entry<Integer, Map<Integer, Long>> e : cntrMap.entrySet())
-            partitionHistoryCounters(e.getKey(), e.getValue());
+        for (Map.Entry<Integer, Map<Integer, Long>> e : cntrMap.entrySet()) {
+            Map<Integer, Long> historyCntrs = e.getValue();
+
+            if (historyCntrs.isEmpty())
+                return;

Review Comment:
   You're right, I fixed 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to