anton-vinogradov commented on code in PR #13095:
URL: https://github.com/apache/ignite/pull/13095#discussion_r3664587882


##########
modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java:
##########
@@ -140,6 +145,16 @@ public boolean skipOnTimeout() {
         return skipOnTimeout;
     }
 
+    /** Marks this message as marshalled. */
+    void markMarshalled() {
+        marshalled = true;
+    }
+
+    /** @return {@code true} if this message has been marshalled. */
+    boolean marshalled() {

Review Comment:
   These are the marshal side, and the double-unmarshal mechanics do not cover 
it: MessageUnmarshalOnceCheck tracks finish-unmarshal of a payload and is gated 
by IGNITE_MESSAGE_UNMARSHAL_ONCE_CHECK, i.e. it only runs under tests. The flag 
here guards three different invariants of the prepare-once scheme on the send 
path: `marshal()` asserts a wrap is never marshalled twice (marshalling is not 
idempotent — GridCacheEntryInfo rebases expireTime, for one), `sendPrepared()` 
asserts nothing unprepared is sent, and `sendMarshalled()` asserts nothing 
unmarshalled reaches the wire. That is what makes prepare-once safe for both 
fan-out (sendToMany) and retry (sendWithRetry), and it caught a real 
double-marshal while the retry loop was being reworked in this PR. 
MessageMarshalOnceTest covers two scenarios; the asserts cover every other 
path, including future ones. Assertions are off in production, so the cost is a 
boolean field on GridIoMessage.



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