Anton Vinogradov created IGNITE-28940:
-----------------------------------------
Summary: Select the marshaller by transport instead of per message
class
Key: IGNITE-28940
URL: https://issues.apache.org/jira/browse/IGNITE-28940
Project: Ignite
Issue Type: Sub-task
Components: messaging
Reporter: Anton Vinogradov
Assignee: Anton Vinogradov
Fix For: 2.19
h3. Goal
Take the choice away from the message class and derive it from the place where
marshalling actually happens.
h3. Why
Whether binary may be used is decided by the call site, not by the message
type: binary blocks on a cluster-wide class registration, which is impossible
on the discovery thread. The call sites are already split by transport:
* communication - {{GridIoManager}} (marshal on send and the unmarshal paths),
{{GridCacheIoManager}}, {{IgniteTxManager}},
{{GridDhtPartitionsExchangeFuture}}, {{CacheContinuousQueryHandler}},
{{DataStreamProcessor}}, calcite {{MessageServiceImpl}};
* discovery - {{TcpDiscoveryIoSession}} and ZooKeeper
{{DiscoveryMessageParser}}.
The hand-written half of the API is already transport agnostic:
{{MarshallableMessage#marshal(Marshaller)}} takes the marshaller as a
parameter. Only the generated half keeps it in a field, which is exactly what
pins it to the class.
h3. How
* add a {{Marshaller}} parameter to {{MessageMarshaller}} and
{{MessageMarshalling}}; the generator stops storing it and passes it down into
nested messages;
* communication call sites pass {{ctx.marshaller()}}, discovery call sites pass
{{marshallerContext().jdkMarshaller()}};
* delete {{@UseBinaryMarshaller}},
{{AbstractMarshallableMessageFactoryProvider#init}} and both marshaller fields.
The wire format changes for four classes, deliberately:
* {{ErrorMessage}}, {{PartitionHashRecord}}, {{TransactionsHashRecord}} - jdk
to binary. Safe for {{ErrorMessage}}: {{java.lang.Throwable}} declares
{{writeObject}}/{{readObject}}, so every exception matches
{{isCustomJavaSerialization}} and binary delegates to {{OptimizedMarshaller}} -
the format changes, the semantics do not.
* {{BinaryMetadataVersionInfo}} - binary to jdk, aligning it with
{{MetadataUpdateProposedMessage}}; moot if the blob-removal subtask lands first.
Note: {{MessageMarshaller}} lives in the public
{{org.apache.ignite.plugin.extensions.communication}} package; outside the
generator it is implemented only by three tests.
h3. Expected result
Zero places to annotate: the marshaller is a property of the send, not of the
type. The inherited-field trap and the nested-message override disappear by
construction, because one marshaller serves the whole message tree of a single
send.
h3. How to verify
Run All; targeted runs for continuous queries, idle_verify,
{{DistributedProcess}} and calcite; plus a test that a message type marshalled
through either transport round-trips correctly.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)