Alex Abashev created IGNITE-28618:
-------------------------------------

             Summary: Move finishUnmarshal out of NIO communication thread
                 Key: IGNITE-28618
                 URL: https://issues.apache.org/jira/browse/IGNITE-28618
             Project: Ignite
          Issue Type: Sub-task
            Reporter: Alex Abashev


h2. Summary

Receive-side mirror of IGNITE-28520. Move the generic post-deserialisation 
{{CacheObject.finishUnmarshal}} traversal off the NIO worker by adding 
{{finishUnmarshalCacheObjects}} to {{MessageSerializer}} and auto-invoking it 
from {{GridCacheIoManager.unmarshall}} on the user-listener-dispatch thread, 
before the message is handed to {{processMessage}}.

After this lands the receive path looks like:

# {{ser.finishUnmarshalCacheObjects(msg, cacheObjCtx, ldr)}} — new auto-invoked 
traversal of {{@Order}}-annotated {{CacheObject}} / nested {{Message}} fields;
# {{cacheMsg.finishUnmarshal(cctx, ldr)}} — existing hand-written hook 
(legacy), runs after.

The same ordering rationale as send-side: legacy may rely on {{val}} being 
already populated (for tx-key hashing, validation, etc.), so auto-invoke must 
run first.

h2. Scope

* Add {{default void finishUnmarshalCacheObjects(M msg, CacheObjectValueContext 
ctx, ClassLoader ldr)}} to {{MessageSerializer}} (no-op default).
* {{MessageSerializerGenerator}}: emit symmetric 
{{finishUnmarshalCacheObjects}} method (with {{@Override}}) on every serializer 
with traversable {{@Order}} fields; recurse via per-class 
{{*_SER.finishUnmarshalCacheObjects(...)}}; map traversal walks both sides (key 
+ value).
* {{GridCacheIoManager.unmarshall}}: add 
{{finishUnmarshalGeneratedCacheObjects(cacheMsg, ldr)}} call before 
{{cacheMsg.finishUnmarshal(cctx, ldr)}}; helper gated on {{instanceof 
GridCacheIdMessage}} mirror of the prepare-side.
* Phase 2 cleanup: where a {{GridCacheMessage}} subclass 
{{finishUnmarshal(GridCacheSharedContext, ClassLoader)}} override is a pure 
{{@Order}}-CO traversal, drop it. Mirror list from IGNITE-28520:
** {{GridCacheTtlUpdateRequest}}, {{GridDhtForceKeysRequest}}, 
{{GridNearUnlockRequest}}, {{GridDhtUnlockRequest}}, 
{{GridDistributedLockRequest}}, {{GridDistributedLockResponse}}, 
{{GridDhtAtomicUpdateResponse}}, {{GridDhtAtomicNearResponse}}, 
{{GridNearGetRequest}}, {{GridNearAtomicUpdateResponse.finishUnmarshal}} — line 
{{ret.finishUnmarshal(cctx, ldr)}}.
* Update {{GridCacheReturn.finishUnmarshal}} to delegate the {{CacheObject}} 
traversal to the generated 
{{GridCacheReturnSerializer.finishUnmarshalCacheObjects}} (mirror of current 
{{prepareMarshal}} bridge); the post-traversal binary-unwrapping 
({{unwrapBinaryIfNeeded}} of {{cacheObj}} and {{invokeResCol}}, building the 
{{CacheInvokeResult}} map into {{v}}) stays inline — it is not part of the 
serializer contract.

h2. Out of scope

* The send-side migration is IGNITE-28520; this ticket only mirrors it for the 
receive side.
* Extending auto-invoke beyond {{GridCacheIdMessage}} for either direction — 
IGNITE-ZZZZZ.

h2. Acceptance criteria

* {{GridCacheIoManager.unmarshall}} invokes the new helper for 
{{GridCacheIdMessage}} subclasses, before the legacy {{finishUnmarshal}} call.
* {{MessageProcessorTest}} green with regenerated fixtures (each fixture now 
has both {{prepareMarshalCacheObjects}} and {{finishUnmarshalCacheObjects}}).
* Same targeted-suite gating as IGNITE-28520; in addition: 
{{IgniteCacheQueryMultiThreadedSelfTest}}, 
{{GridCacheReturnValueTransferSelfTest}} cover both directions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to