anton-vinogradov opened a new pull request, #13408:
URL: https://github.com/apache/ignite/pull/13408

   ### What
   
   `TxLocksRequest` and `GridNearGetRequest` converted between their logical 
field and their wire form by hand:
   
   - `TxLocksRequest#txKeys` was mirrored into a companion `IgniteTxKey[] 
txKeysArr`;
   - `GridNearGetRequest` split its key map into `keys` + `readersFlags` in the 
constructor and zipped it back lazily in `keyMap()`.
   
   Both conversions are gone. `TxLocksRequest#txKeys` is now an ordinary 
`@Order` field, and `GridNearGetRequest` declares the map itself, leaving the 
zipping to the generated marshalling.
   
   ### Why
   
   The conversions existed because a `KeyCacheObject` read off the wire has no 
hash code yet — it throws until the message is unmarshalled — so a `Set` or a 
`Map` keyed by one cannot be filled while the message is being read. That 
cannot be fixed in `hashCode()` itself: it has to match the hash of the 
resolved user key, which is only recoverable from the bytes for binary keys.
   
   The generated marshalling already resolves the keys before building the map, 
which is exactly the place where the conversion belongs. And a `Collection` 
field needs no mechanism at all — the reader fills a list and never hashes 
anything, which is why `txKeys` needs no companion.
   
   ### Notes for review
   
   - `txKeys()` returns a `Collection` instead of a `Set`. The only consumer, 
`IgniteTxManager#txLocksInfo`, already accepted a `Collection` and only 
iterates it.
   - `GridNearGetRequest#keyMap` is rebuilt as a `HashMap` rather than a 
`LinkedHashMap`, so its iteration order on the receiving side is no longer the 
wire order. Nothing depends on that order.
   - The reader flags are now always sent; previously they were left out when 
`addReader` was `false`. That is one byte per key.
   - `partition()` reads whichever of the two fields is populated: it is called 
before `unmarshal` when dispatching to a stripe, and on an unmarshalled message 
when a node sends to itself.
   
   Both messages change their wire layout, so the protected-classes check will 
flag them for rolling upgrade.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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