You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Gaurav Ahuja <ga...@gmail.com> on 2022/08/25 16:17:45 UTC

Registration order with Kryo

Hi,

I have a flink app that has a long development roadmap and will be worked
on by multiple people. We store state for a long period of time (~weeks)
and during that time there is a possibility that the long list of classes
registered with Kryo might change.

For example:

*env.registerTypeWithKryoSerializer(Message1.class, CustomSerializer.class)*
*env.registerTypeWithKryoSerializer(Message2.class, CustomSerializer.class)*

might get changed to

*env.registerTypeWithKryoSerializer(Message0.class, CustomSerializer.class)*
*env.registerTypeWithKryoSerializer(Message1.class, CustomSerializer.class)*
*env.registerTypeWithKryoSerializer(Message2.class, CustomSerializer.class)*

Kyro's documentation makes it clear that the registration ids should remain
the same while serialization and deserialization. Thus the user needs to
make sure that either the order of registration does not change or provide
explicit registration id for a class. Flink does not expose the
registration id to the user and handles registering with Kryo internally.

Does the above scenario lead to state with data from Message1 or Message2
to not be deserialized correctly because the registration ids have changed?
If so, what would be the general recommendation if we need to remove or add
classes registered with Kryo?

Thanks
Gaurav