feat: Flink 2.2 compatibility and dual-dist packaging#4307
Open
macdoor wants to merge 4 commits intoapache:masterfrom
Open
feat: Flink 2.2 compatibility and dual-dist packaging#4307macdoor wants to merge 4 commits intoapache:masterfrom
macdoor wants to merge 4 commits intoapache:masterfrom
Conversation
added 3 commits
March 6, 2026 19:24
Add Flink 2.2 compatibility layer: - flink-cdc-flink-compat modules (flink1/flink2) for bridging API differences between Flink 1.x and 2.x - DataSinkTranslator: reflection-based two-phase commit support for sinks using TwoPhaseCommittingSink (Flink 1.x) or SupportsCommitter (Flink 2.x) - DataSourceTranslator: compat for source function provider changes - DataSinkWriterOperator: reflection-based SinkWriterOperator creation compatible with Flink 2.2 constructor changes - Runtime serializers: TypeSerializerSchemaCompatibility compat - dist assembly: separate Flink 1.20 and 2.2 distribution packaging - Updated connectors for Flink 2.2 API changes Made-with: Cursor
- Paimon connector: paimon-flink as provided, remove shade; thin jar. Put paimon-flink, paimon-s3, etc. in flink/lib. - MySQL: flink-connector-mysql-cdc excludes driver from debezium, adds mysql-connector-j as provided. Put mysql-connector-j in flink/lib. - OpenGauss: flink-connector-opengauss-cdc opengauss-jdbc as provided; pipeline-connector-opengauss removes opengauss-jdbc from shade. Put opengauss-jdbc in flink/lib. Made-with: Cursor
Flink 2.2 SinkWriterOperator sets emitDownstream based on whether the sink implements SupportsCommitter. Paimon uses the older TwoPhaseCommittingSink interface, causing emitDownstream=false and committables to be silently discarded. This results in data files written to storage but no snapshot/manifest created, making data unqueryable. Fix: after wrapping SinkWriterOperator, force emitDownstream=true and fill committableSerializer via reflection when the sink supports two-phase commit but does not implement SupportsCommitter. Made-with: Cursor
db59490 to
df993b0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Design rationale
The key design decision is to keep connector modules compiled against Flink 1.20 APIs, and only switch the small set of version-specific compat modules and the dist JAR to Flink 2.2 when needed.
Connectors stay on Flink 1.20 API
Two dist JARs as "launchers"
flink-cdc-dist-<version>-1.20.jarbundlingFlink1PipelineBridge.flink-cdc-dist-<version>-2.2.jarbundlingFlink2PipelineBridgeplus a reflection-based fix inDataSinkWriterOperatorto ensure two-phase committing sinks (like Paimon) still emit committables whenSupportsCommitteris not implemented.Why not compile everything against Flink 2.2?
SinkFunction/SourceFunction, moved/renamed classes and methods, etc.).This PR therefore keeps 1.20 as the compilation baseline for connectors, and uses a small, well-isolated compat layer to bridge the behavioral differences between Flink 1.20 and 2.2.
Build instructions
To build both Flink 1.20 and Flink 2.2 dist artifacts from this branch (assuming Java 17):
Deployment (recommended)
flink-cdc-dist-<version>-1.20.jarinto$FLINK_CDC_HOME/lib/and add the desired CDC connector JARs (MySQL, PostgreSQL, Paimon, OpenGauss, etc.) to the same$FLINK_HOME/lib/(or your preferred plugin/lib directory).flink-cdc-dist-<version>-2.2.jarinto$FLINK_CDC_HOME/lib/and reuse the same set of connector JARs as for Flink 1.20.flink-cdc-dist-*.jarin the same$FLINK_CDC_HOME/lib/to avoid class loading conflicts.