[ 
https://issues.apache.org/jira/browse/IGNITE-28937?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Anton Vinogradov updated IGNITE-28937:
--------------------------------------
    Description: 
*No wire format change.*

h3. Goal

Use one way to register a message, and keep the marshaller written in one place.

h3. Why

After IGNITE-28929 the marshaller is set by {{@UseBinaryMarshaller}}. Since 
then {{CoreMessagesProvider#withSchema}} and {{#withNoSchema}} do the same 
thing. They differ only by an assert that the annotation matches the method. So 
the same fact is stored twice, and the assert only checks that the two copies 
agree. {{CalciteMessageFactory}} already uses the simple form 
{{register(factory, cls, id)}}.

Also, {{register}} passes a {{Marshaller}} to the serializer and deployer 
lookups, but they never take one: 0 of 462 generated serializers and 0 of 31 
generated deployers have such a constructor.

h3. How

* replace the 297 {{withSchema}} and {{withNoSchema}} calls with 
{{register(factory, cls, msgIdx++)}}, and delete both methods;
* pass the marshaller only where the {{Marshaller}} companion is created.

h3. Expected result

Registration in core looks like calcite. Behaviour does not change: generated 
companions stay the same.

Note: after this change a wrong annotation is ignored instead of failing an 
assert. This ends when IGNITE-28940 removes the annotation.

h3. How to verify

Compare generated companions before and after: they must be equal. Run 
{{MessageFactoryMarshallerInitializationTest}}, {{MessageProcessorTest}} and 
{{DirectMarshallingMessagesTest}}.

  was:
h3. Goal

One registration form for every message, and a single source of truth for the 
marshaller.

h3. Why

After IGNITE-28929 the marshaller is stated by {{@UseBinaryMarshaller}}, and 
{{CoreMessagesProvider#withSchema}} / {{#withNoSchema}} became identical - they 
differ only by an assertion that the annotation matches the chosen helper. The 
truth is duplicated in two places and the assertion exists solely to catch the 
two drifting apart. The same commit already left the plain form 
{{register(factory, cls, id)}} in {{CalciteMessageFactory}}.

Additionally, {{register}} threads a {{Marshaller}} into the {{Serializer}} and 
{{Deployer}} companion lookups, which never take one: 0 of 462 generated 
serializers and 0 of 31 generated deployers declare a constructor with 
{{Marshaller}}, and the generators cannot emit one.

h3. How

* replace the 297 {{withSchema}}/{{withNoSchema}} calls with 
{{register(factory, cls, msgIdx++)}} and delete both helpers;
* pass the marshaller only into the {{Marshaller}} companion lookup in 
{{AbstractMarshallableMessageFactoryProvider}}.

h3. Expected result

Registration in core reads exactly like calcite, and the marshaller is stated 
once. Behaviour is unchanged: no generated companion differs.

Note: until the transport subtask lands, a misplaced annotation is silently 
ignored instead of tripping an assertion - the window is closed for good when 
the annotation itself is removed.

h3. How to verify

Diff the generated companions before and after - they must be identical; 
{{MessageFactoryMarshallerInitializationTest}}, {{MessageProcessorTest}}, 
{{DirectMarshallingMessagesTest}}.


> Register core messages uniformly: drop withSchema/withNoSchema
> --------------------------------------------------------------
>
>                 Key: IGNITE-28937
>                 URL: https://issues.apache.org/jira/browse/IGNITE-28937
>             Project: Ignite
>          Issue Type: Sub-task
>          Components: messaging
>            Reporter: Anton Vinogradov
>            Assignee: Anton Vinogradov
>            Priority: Major
>             Fix For: 2.19
>
>
> *No wire format change.*
> h3. Goal
> Use one way to register a message, and keep the marshaller written in one 
> place.
> h3. Why
> After IGNITE-28929 the marshaller is set by {{@UseBinaryMarshaller}}. Since 
> then {{CoreMessagesProvider#withSchema}} and {{#withNoSchema}} do the same 
> thing. They differ only by an assert that the annotation matches the method. 
> So the same fact is stored twice, and the assert only checks that the two 
> copies agree. {{CalciteMessageFactory}} already uses the simple form 
> {{register(factory, cls, id)}}.
> Also, {{register}} passes a {{Marshaller}} to the serializer and deployer 
> lookups, but they never take one: 0 of 462 generated serializers and 0 of 31 
> generated deployers have such a constructor.
> h3. How
> * replace the 297 {{withSchema}} and {{withNoSchema}} calls with 
> {{register(factory, cls, msgIdx++)}}, and delete both methods;
> * pass the marshaller only where the {{Marshaller}} companion is created.
> h3. Expected result
> Registration in core looks like calcite. Behaviour does not change: generated 
> companions stay the same.
> Note: after this change a wrong annotation is ignored instead of failing an 
> assert. This ends when IGNITE-28940 removes the annotation.
> h3. How to verify
> Compare generated companions before and after: they must be equal. Run 
> {{MessageFactoryMarshallerInitializationTest}}, {{MessageProcessorTest}} and 
> {{DirectMarshallingMessagesTest}}.



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

Reply via email to