Skip to content

Add the possibility to handle state evolution without breaking state compatibility #240

Closed
@arnaud-daroussin

Description

@arnaud-daroussin

Hi @novakov-alexey,

I noticed several SerializerSnapshot cannot handle evolutions that break serialization backward compatibility because they don't serialize their version number. And so when reading back the serialized stream, they don't know which version of the serializer wrote it, to be able to react and recover from a previous version.

Identified serializer snapshots are:

  • CollectionSerializerSnapshot
  • CoproductSerializerSnapshot
  • MappedSerializerSnapshot
  • ScalaCaseObjectSerializerSnapshot

Flink provides 2 utility methods to handle this the right way without headache:

An example on how to react on different version numbers can be found here: https://github.com/apache/flink/blob/release-1.20/flink-core/src/main/java/org/apache/flink/api/common/typeutils/CompositeTypeSerializerSnapshot.java#L162

For exemple I think you could have introduced "class arity usage" feature in case class smoothly, without breaking state compatibility with previous versions. Like it is done here: https://github.com/apache/flink/blob/release-1.20/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/RowSerializer.java#L501

Unfortunately, there is no possibility to add usage of version number without breaking state compatibility one last time, that's why I suggest to make this change starting with Flink 2 only, as state compatibility is not an option between Flink 1 and 2 anyway.

What do you think of this?

Do you want to do it yourself, or can I propose a PR?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions