[ 
https://issues.apache.org/jira/browse/IGNITE-27977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18100819#comment-18100819
 ] 

Anton Vinogradov commented on IGNITE-27977:
-------------------------------------------

This one is blocked by IGNITE-28940, and the reason is worth writing down so 
nobody walks into it.

The obvious fix is to make the receiver a normal field with a wire companion:
{code:java}
@Marshalled("updaterBytes")
StreamReceiver<?, ?> updater;

@Order(3)
byte[] updaterBytes;
{code}

That would change the marshaller of the field, silently:
* today the sender marshals the receiver with the node marshaller - 
DataStreamerImpl calls {{U.marshal(ctx, rcvr)}}, and 
{{U.marshal(GridKernalContext, Object)}} uses {{ctx.marshaller()}}, which is 
{{BinaryMarshaller}} by default;
* the generated marshaller would use the one from registration, and 
{{DataStreamerRequest}} is registered with {{withNoSchema}} in 
{{CoreMessagesProvider}}, so it gets {{JdkMarshaller}}.

The receiver is a user class, so binary and jdk do not produce the same bytes 
and do not accept the same classes. Picking the marshaller for a message field 
is exactly what IGNITE-28940 is about, so this ticket should wait for it.

Two more notes for whoever picks this up:
# The receive side is the real win. {{DataStreamProcessor}} unmarshals the 
receiver by hand after resolving the deployment. The class is already a 
{{DeferredUnmarshalMessage}}, and {{GridIoManager#unmarshalPayload}} skips 
those, so the consumer can call {{MessageMarshalling.unmarshal(req, ctx, null, 
U.resolveClassLoader(clsLdr, ctx.config()))}} at that same point. 
{{GridJobProcessor}} already does this for {{GridJobExecuteRequest}}.
# The send side caches the bytes on purpose: {{DataStreamerImpl}} marshals the 
receiver once and reuses it for every batch. The generated marshal only runs 
when the companion is null ({{if (obj != null && bytes == null)}}), so the 
cache survives the conversion.


> Refactor bytes serialization for DataStreamerRequest 
> -----------------------------------------------------
>
>                 Key: IGNITE-27977
>                 URL: https://issues.apache.org/jira/browse/IGNITE-27977
>             Project: Ignite
>          Issue Type: Task
>            Reporter: Alex Abashev
>            Priority: Major
>              Labels: IEP-132, ise, wire-format
>             Fix For: 2.19
>
>
> Refactor bytes serialization for DataStreamerRequest 



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

Reply via email to