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

Anton Vinogradov updated IGNITE-28942:
--------------------------------------
    Labels: IEP-132  (was: )

> Evaluate replacing JdkMarshaller with binary in a self-contained mode
> ---------------------------------------------------------------------
>
>                 Key: IGNITE-28942
>                 URL: https://issues.apache.org/jira/browse/IGNITE-28942
>             Project: Ignite
>          Issue Type: Sub-task
>          Components: messaging
>            Reporter: Anton Vinogradov
>            Assignee: Anton Vinogradov
>            Priority: Major
>              Labels: IEP-132
>             Fix For: 2.19
>
>
> *Research task, finished. Result: keep {{JdkMarshaller}}. Kept for the record 
> so the question does not come back.*
> h3. Question
> Can {{JdkMarshaller}} be dropped and binary used everywhere?
> h3. What was checked
> *Binary can be self-contained.* When a type is not registered, binary writes 
> {{UNREGISTERED_TYPE_ID}} plus the class name 
> ({{BinaryWriterExImpl#preWrite}}), and metadata can stay local 
> ({{registerClassNameLocally}}, {{addMetaLocally}}). Thin client, JDBC and the 
> standalone WAL reader already run binary with no cluster at all. So "binary 
> needs discovery" is not true of the format.
> *But only with a full footer.* An object written by one context and read by a 
> completely empty one:
> * {{compactFooter = false}}: read succeeds, cycles included, 84 bytes against 
> 121 for jdk;
> * {{compactFooter = true}} (the default): read fails with "Cannot find 
> metadata for object with compact footer", because the field layout comes from 
> metadata that discovery distributes.
> {{compactFooter}} is a node-wide setting: {{BinaryWriterExImpl#postWrite}} 
> reads {{ctx.isCompactFooter()}}. A per-call full-footer mode would have to be 
> added.
> *The unregistered path is slow, and the reason is known.* 160 us against 24 
> for a {{CacheConfiguration}}. {{BinaryContext#registerUserClassDescriptor}} 
> stores the descriptor in {{descByCls}} only when registration succeeded; 
> otherwise it returns the descriptor without caching it, so it is rebuilt by 
> reflection on every call.
> *Pre-registration is not closed under nesting.* Marshalling a plain 
> {{CacheConfiguration}} needs 9 types; 
> {{javax.cache.configuration.FactoryBuilder$SingletonFactory}} and 
> {{javax.cache.expiry.EternalExpiryPolicy}} are missing from 
> {{META-INF/classnames.properties}}. {{failIfUnregistered = true}} does not 
> help - it fires for internal types too.
> *On-disk formats would become a migration.* Cache configurations, metastore, 
> snapshots and dumps are written with jdk and read by offline tools 
> ({{DumpReader}} builds {{Marshallers.jdk()}} directly). Note that wire 
> companions in such classes are {{transient}}, so today the two formats do not 
> interfere - dropping jdk would end that.
> *And it would not even remove Java serialization.* 
> {{BinaryUtils#isCustomJavaSerialization}} walks the whole hierarchy, so every 
> {{Externalizable}} class and every class with {{writeObject}} goes to 
> {{OptimizedMarshaller}} anyway. Three implementations would become two, not 
> one.
> h3. Answer
> Keep {{JdkMarshaller}}. The move costs a new format mode, a descriptor-cache 
> change, and a migration of data already written on user disks, and it buys 
> one implementation less plus a few dozen bytes per object.
> This does not affect the rest of IGNITE-28935: it removes the *choice* of a 
> marshaller, not a marshaller. If the picture changes later, only the call 
> sites have to be revisited.



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

Reply via email to