kitalkuyo-gita commented on issue #2818: URL: https://github.com/apache/fory/issues/2818#issuecomment-3435702360
Hi. I'm glad you asked this question. It appears that the automatically assigned ID is serialized into Redis to identify the class type. If the Spring container initialization order changes, the same class might be assigned a different ID, causing the class corresponding to ID 5 to change from Class A to Class B during deserialization. can see: https://github.com/apache/fory/pull/2799 Meta Share Mode Mitigation Mechanism Solution 4 mentions enabling Meta Share mode: ``` Fory fory = Fory.builder() .withCompatibleMode(CompatibleMode.COMPATIBLE) .withMetaShare(true) .build(); ``` When CompatibleMode.COMPATIBLE is enabled, Meta Share is automatically enabled (ForyBuilder.java:402-418). The key benefit of Meta Share is that it includes the full class definition (ClassDef) in the serialized data, not just the class ID (java_serialization_spec.md:115-131). Including field metadata: Complete field information (field names, types, etc.) of the class is written during serialization. MetaSharedSerializer.java:47-92 Field-level matching: During deserialization, Fory compares the fields in the ClassDef with the fields of the target class for field-level matching and mapping. Fault-tolerance mechanism: Even if the class ID mismatch occurs, due to the complete field information, Fory can: - Skip fields that do not exist in the target class - Use default values for fields missing in the source data - Intelligent matching based on field names and types - DifferentPOJOCompatibleSerializerTest.java:58-82 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
