[FLINK-38729] Add support for Flink 2.2.0#4294
Conversation
There was a problem hiding this comment.
Just investigated the implementation in apache/fluss#1176. Seems instead of creating a replica for each file that uses incompatible API (between Flink 1.x and 2.x), Hongshun introduces a compatible layer in fluss-flink-common package and puts all incompatible API usages inside, and dispatch it in fluss-flink-1.x and fluss-flink-2.x. I think if we took this approach, the only module that needs to be versioned is flink-cdc-common.
The obvious advantage is we don't need so much code duplication. This PR adds ~20k sloc code (mostly duplicate, and it's hard to review what's changed) while Fluss support is merely +856 -36. Though two codebase could not be compared directly, such huge difference is not negligible. This design also causes maintenance issue, as any following PR modifying related file must remember updating both 1.x and 2.x implementation and keep them in-sync.
I'm not strongly against the approach used in this PR, just wondering if the alternative solution is possible / why it's impossible.
|
Hi @yuxiqian, We've been working on Flink 2.2 compatibility in a fork and have a working implementation following the approach referenced in fluss#1176 — i.e., introducing a version-specific compat module with runtime bridges. Our branch: https://github.com/macdoor/flink-cdc/tree/feature/opengauss-flink22-compat Key changes we made to get OpenGauss → Paimon pipelines running on Flink 2.2: flink-cdc-flink-compat module — two sub-modules: flink-cdc-flink-compat-flink1 (Flink 1.x bridge with SinkFunction/SourceFunction) and flink-cdc-flink-compat-flink2 (Flink 2.x stub classes: Sink$InitContext, CatalogFactory, Catalog). The pipeline now runs end-to-end on Flink 2.2.0 with a standalone session cluster (OpenGauss source → Paimon sink, all 4 operator stages visible including Sink Committer). Happy to share details, open a draft PR, or contribute directly to this effort. Let us know what would be most helpful! |
|
Hi @macdoor, I pulled your branch, but the code in this branch doesn't seem to be complete (it doesn't even compile). Did I miss something? Of course, your implementation in the PR is more concise. If you can get it to compile and run on Flink 2.2, feel free to submit a PR first so we can verify that the tests pass. |
375a622 to
5b47571
Compare
a814a86 to
acfb3b1
Compare
abb4dee to
b03ff0c
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 74 out of 74 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: xiaoxiong.duan@zznode.com <xiaoxiong.duan@zznode.com>
2d09d68 to
3240e50
Compare
yuxiqian
left a comment
There was a problem hiding this comment.
Looks good to me. This PR is already in good shape, and most code duplication has been eliminated. As some popular connectors need to be ported to Flink 2.x before the code freeze, I hope this could be merged soon, and we can polish the shim layer later.
|
@lvyanquan Thanks for the refactor and aligned with flussxflink adapter solution, current work looks good to me, +1. |
|
@lvyanquan I was swamped and did not have time to check this thoroughly yet, although I'm happy to see this merged and moved forward in general! 1 question: |
Hi, ferenc. Thank you for your suggestion. Maintaining two separate branches (major versions)—one for I think the key issue is whether we will have many new features that depend on I prefer to wait until we either adopt |
|
@lvyanquan That sounds reasonable based on the current demand, thanks for the write up! |
Co-authored-by: xiaoxiong.duan@zznode.com <xiaoxiong.duan@zznode.com>
Co-authored-by: xiaoxiong.duan@zznode.com <xiaoxiong.duan@zznode.com>
Introduction
Building upon the foundation where existing modules continue to use Flink 1.20 dependencies, support for Flink 2.x versions is provided through newly added modules.
Development Plan
I plan to complete full support for Flink 2.x versions through three steps:
and perform integration tests and end-to-end tests on these modules based on a simple values pipeline
connector to verify correctness.
our most commonly used CDC connector.
feasible.
This PR will complete the work of the first step.
Topics for Discussion
1. Module Design
Question: Is it necessary to design each module with a structure consisting of a common module, a module with 1.x API, and a module with 2.x API, as Paimon does?
My Answer: This would require creating three modules for every module in the project. I think this introduces too many additional modules. Therefore, I will keep existing modules' dependency on Flink 1.x unchanged, and only add new modules that depend on Flink 2.x. I will rewrite classes that depend on the new API, and use the shade plugin to reduce the number of classes that need to be rewritten in the new modules.
2. Test Coverage
Question: Is it necessary to add tests equivalent to those in the 1.x modules for each newly added 2.x module?
My Answer: This is a difficult decision point. Adding sufficient tests can guarantee the correctness and reliability of 2.x modules, but it would introduce a large amount of duplicate code and also increase the time required for CI runs. To avoid the burden of review, I have only added composer tests and e2e tests in this PR to ensure that the support for Flink 2.x is functional. I plan to add more complete tests in subsequent PRs (if necessary).
The above lists the points that I still consider uncertain during the implementation of this PR. Discussions are welcome.