flink icon indicating copy to clipboard operation
flink copied to clipboard

[FLINK-30613] Improve resolving schema compatibility -- Milestone one

Open masteryhx opened this issue 2 years ago • 20 comments

What is the purpose of the change

This pr reverses the direction of resolving schema compatibility could improve the usability of schema evolution. See FLIP-263 for more details.

Brief change log

In the milestone one, we should:

  1. Add an extra method (TypeserializeSnapshotr#resolveSchemaCompatibility(TypeSerializerSnapshot<T> oldSerializerSnapshot)) in TypeSerializerSnapshot.java as above.
  2. Mark the original method as deprecated and it will use new method to resolve as default.
  3. Implement the new method for all built-in TypeserializerSnapshots.

Verifying this change

This change is already covered by existing tests, such as TypeSerializerUpgradeTestBase, PojoSerializerSnapshotTest.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): yes
  • The serializers: yes
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? docs

masteryhx avatar Jan 10 '23 06:01 masteryhx

CI report:

  • 5d774fdf50451923c5474c6ca1116c5f62a87c81 Azure: FAILURE
Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

flinkbot avatar Jan 10 '23 06:01 flinkbot

@flinkbot run azure

masteryhx avatar Jan 16 '23 02:01 masteryhx

@gaoyunhaii @dawidwys Could you help to take a review ? I'd like to make it usable in 1.17. Thanks a lot!

masteryhx avatar Jan 16 '23 02:01 masteryhx

I started the review, but since I started finding issues or potential issues in the migrated methods, would you be so kind and split migrating serializers/snapshots to separate commits? That would help me tremendously to do a proper review.

Thanks a lot for the review. I have splitted them as clear as possible.

masteryhx avatar Jan 24 '23 03:01 masteryhx

@dawidwys Could you help to take a review again?

masteryhx avatar Jan 29 '23 15:01 masteryhx

Sure, I will during my working days. Also to be clear it's definitely too late now for it to make it to 1.17. It's in a too important area to rush it in the last day of the development cycle, especially with so many open questions still.

dawidwys avatar Jan 29 '23 15:01 dawidwys

Hey @masteryhx, do you plan to work on that for 1.18?

dawidwys avatar Mar 06 '23 10:03 dawidwys

Hey @masteryhx, do you plan to work on that for 1.18?

Sure, I'd like to. Thanks a lot for the reminder. Big sorry for the delayed update due to my personal business last month. I will rework on the pr this month.

masteryhx avatar Mar 08 '23 03:03 masteryhx

@flinkbot run azure

masteryhx avatar Jun 07 '23 06:06 masteryhx

@dawidwys Hi, Sorry for the late update due to personal business. I have updated some previous commits so just also splitted them into different commits for the convinence of review. I will continue to update after your every review in the upcoming time.

BTW, The caller could call the new method instead of the old one currently, I will prepare a new pr for it after this pr.

masteryhx avatar Jun 07 '23 11:06 masteryhx

@Zakelly @reswqa Could you also help to take a look ? Thanks a lot!

masteryhx avatar Jun 16 '23 08:06 masteryhx

@flinkbot run azure

masteryhx avatar Jun 25 '23 06:06 masteryhx

rebased. @Zakelly Could you also help to take a look ? Thanks a lot!

masteryhx avatar Nov 09 '23 04:11 masteryhx

Thanks @masteryhx for the contribution!

I didn't finish the review, and left some minor comments. Please take a look in your free time, thanks~

Thanks a lot for your time! I have updated the pr by adding two commits. I will rebase some commits after the pr is approved. Please take a review again in your free time. Thanks a lot again!

masteryhx avatar Nov 27 '23 03:11 masteryhx

Hi @masteryhx , thanks for the contribution and update!

I have reviewed this PR and left some comments. Please take a look in your free time, thanks~

Also, The Schema Compatibility related code is Flink’s infrastructure and is used by many components. I didn't change and read related code before this PR, so I'm not professional in this area. I have reviewed, but it would be great to have more committers who are familiar with this area to help review. It will be helpful for the bug-free.

Thanks a lot for the detailed review. We may have some key problems remaing in the comment to discuss. I'll update the pr after we are on the same way about these problems. Also ping @Zakelly @fredia here to help to review and discuss together, Thanks a lot for your time!

masteryhx avatar Dec 14 '23 02:12 masteryhx

Hi @masteryhx , sorry for the late reply!

After reading your PR, I finally figured out why the default implementation of old method and new method should call each other. I think we could do something tricky to check whether one of the old and new methods has been implemented in specific TypeSerializerSnapshot before it is called. https://stackoverflow.com/a/2315467 this may provide some ideas. WDYT?

Zakelly avatar Dec 14 '23 17:12 Zakelly

Hi @masteryhx , sorry for the late reply!

After reading your PR, I finally figured out why the default implementation of old method and new method should call each other. I think we could do something tricky to check whether one of the old and new methods has been implemented in specific TypeSerializerSnapshot before it is called. https://stackoverflow.com/a/2315467 this may provide some ideas. WDYT?

Thanks for the advice. It's a good idea to avoid infinite loop when users don't implement both methods. I will update the pr to support this.

masteryhx avatar Dec 15 '23 02:12 masteryhx

@flinkbot run azure

masteryhx avatar Jan 07 '24 04:01 masteryhx

@1996fanrui @Zakelly Thanks for the review. I have updated remaining minor comments. The failed CI about python occurs from yesterday (see other failed cases) which is not related to this pr. @curcur Could you also help to take a review ? Thanks a lot!

masteryhx avatar Jan 07 '24 06:01 masteryhx

Thanks all for the detailed review. Please let me know if any other comments. I will merge it if no other comments beyond two days from now on.

masteryhx avatar Jan 10 '24 04:01 masteryhx