Skip to content

Cleanup: remove compatibility with older versions#358

Open
arnaud-daroussin wants to merge 3 commits intoflink-extended:masterfrom
DataDome-OSS-contrib:cleanup
Open

Cleanup: remove compatibility with older versions#358
arnaud-daroussin wants to merge 3 commits intoflink-extended:masterfrom
DataDome-OSS-contrib:cleanup

Conversation

@arnaud-daroussin
Copy link
Copy Markdown
Contributor

Hi @novakov-alexey,

Here is a small PR to cleanup code around some snapshots:

  • I removed the very complex logic I introduced in PR Flink1: Handle state evolution without breaking state compatibility #251 to keep the compatibility with older versions, it was released in version 1.2.7 almost one year ago. I think it's time to do this cleanup!
  • I found a way to get rid of Java snapshots and move them to Scala:
    • ScalaCaseClassSerializerSnapshot to same file as CaseClassSerializer
    • ScalaEitherSerializerSnapshot to same file as EitherSerializer
    • ScalaOptionSerializerSnapshot to same file as OptionSerializer
    • The problem was Flink's CompositeTypeSerializerSnapshot that requires to call 2 different constructors:
      • one with serializer instance to create the snapshot when serializing,
      • the other without arguments to instantiate by reflection the snapshot when deserializing.
    • But in Scala we can't call 2 different parent constructors, that's why they were left in Java I guess.
    • But I found a way to workaround this Scala limitation: we don't need to call parent constructor with serializer instance, we can reproduce its behavior instead.
    • I moved these snapshots to the same files as their serializers but I can't rename them without breaking the compatibility because their fully qualified class names are written in checkpoints. Or I can move them in their own files if you prefer?
  • I also started a transition to use a CompositeTypeSerializerSnapshot in CoproductSerializerSnapshot. Indeed, usage of a composite applies perfectly well for serializing sealed trait as almost the only thing to serialize is the array of subtype serializers and it can be delegate to the composite.
    • But I had to introduce an "adapter" or a "delegate" to keep the compatibility during the transition to a CompositeTypeSerializerSnapshot because its readSnapshot() method is final so I can't override it to handle both versions to maintain the compatibility.
    • When we want to end the transition (next year? 😂), the code will be very simple like other snapshots using composite.

All these cleanups are preparing the ground for a big feature coming soon, stay tuned 😉

- remove code to keep compatibility with older version
- move java snapshots to scala
- start transition to use CompositeTypeSerializerSnapshot in CoproductSerializerSnapshot
@arnaud-daroussin arnaud-daroussin changed the title Cleanup: remove code keeping the compatibility with older versions Cleanup: remove compatibility with older versions Apr 2, 2026
@novakov-alexey
Copy link
Copy Markdown
Collaborator

hi @arnaud-daroussin ,

thanks! Would it be a release with minor or patch version change?

@arnaud-daroussin
Copy link
Copy Markdown
Contributor Author

arnaud-daroussin commented Apr 2, 2026

You can release it in a minor version if you want but you can also merge it and wait for other PRs, there is no hurry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants