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


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/PartitionUpdateCountersMessage.java:
##########
@@ -66,13 +61,38 @@ public PartitionUpdateCountersMessage(int cacheId, int 
initSize) {
         data = new byte[initSize * ITEM_SIZE];
     }
 
+    /**
+     * @return Payload.
+     */
+    public byte[] payload() {
+        if (data == null)
+            return new byte[0];
+
+        return Arrays.copyOf(data, size * ITEM_SIZE);
+    }
+
+    /**
+     * @param payload New payload.
+     */
+    public void payload(byte[] payload) {
+        data = payload;
+        size = data == null ? 0 : data.length / ITEM_SIZE;

Review Comment:
   `MessageReader#readByteArray` returns null when it couldn't fully extract 
the entire payload from the buffer because the complete byte array didn't fit 
into the read buffer.
   
   Previously, we were setting the size after successfully reading the whole 
byte array using the reader.
   
   In my opinion, the current logic seems fine.



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