[ 
https://issues.apache.org/jira/browse/FLINK-41452?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

peiyu updated FLINK-41452:
--------------------------
    Description: 
h1. Multi-Flink-version compatibility refactor

{panel:title=Status}
Restructured into a series of small, independently mergeable sub-task PRs after 
the first review round found the original single PR too large to review ([PR 
#4623|https://github.com/apache/flink-cdc/pull/4623]). This ticket is the 
umbrella: motivation, series plan, global invariants, and the explicit 
non-goals. The sub-tasks are created under this ticket, one branch and one PR 
each.
{panel}

h2. 1. Goal

Reorganize the Flink version compatibility layer into the per-version layout 
used by Paimon and Fluss, so that supporting an additional Flink version stops 
being "a full build-configuration round plus profile surgery" and becomes "one 
thin module plus wiring". This is a pure structural refactor: no behavior 
change, no new Flink version, no guava change.

h2. 2. The reference shape

* *Paimon*: {{paimon-flink-common}} + {{paimon-flink1-common}} / 
{{paimon-flink2-common}} + one module per supported minor ({{paimon-flink-1.16 
... 1.20}}, {{2.0 ... 2.2}}); every per-version module pins its own 
{{flink.version}}; the newest modules are empty shells that only pin the 
version and produce the per-version jar.
* *Fluss*: {{fluss-flink-common}} + {{fluss-flink-1.18 / 1.19 / 1.20 / 2.2 / 
2.3}}; the 2.x modules carry a handful of same-FQCN adapter classes that 
override the common ones at shade time - supporting Flink 2.3 cost exactly one 
new adapter class.
* Both keep the compatibility layer as the only version-sensitive surface; 
flink-cdc's {{org.apache.flink.*}} backport classes in the 1.20 module are the 
same pattern Fluss uses for its older lines.

h2. 3. The series

|| # || Sub-task || Scope ||
| 1 | Rename the compat modules to version-specific names | 
{{flink-cdc-flink1-compat}} -> {{flink-cdc-compat/flink-cdc-flink-1.20}}, 
{{flink-cdc-flink2-compat}} -> {{flink-cdc-compat/flink-cdc-flink-2.2}}; pure 
rename, ~70 changed lines |
| 2 | Consolidate generation switching into the root pom | the 7 module-local 
flink1/flink2 profiles move into root pom profiles; effective values unchanged 
(~350 lines removed) |
| 3 | Split the compat layer into generation-common and line-pinned thin 
modules | {{flink-cdc-flink1-common}} / {{flink-cdc-flink2-common}} hold the 
classes; thin {{flink-cdc-flink-1.20}} / {{-2.2}} pin their line |
| 4 | Replace main-code reflection into Flink internals with compat adapters | 
SinkWriterOperator probing, StreamExecutionEnvironment.configuration, dead 
reflection; 17 files |
| 5 | Per-version dist from a line-parameterized dist module | 
{{flink-cdc-dist-flink-<line>}}, Yarn dist-jar lookup at runtime, 
release-script adaptation |
| 6 | Per-version connector fat jars from line-parameterized modules | 9 SQL 
connectors + the 4 generation-forked pipeline connectors; the other 11 keep a 
single GAV |
| 7 | Docs refresh for the per-version artifact naming | EN + zh GAV tables and 
naming notes |

An optional follow-up outside the series: stop assembling the starrocks / hudi 
fat jars under the flink2 build (their shaded external SDKs only exist for the 
1.x line).

h2. 4. Global invariants (acceptance bar for every sub-task)

* Both generations build green: full {{mvn clean install -DskipTests}} on the 
default profile and on {{-Pflink2}}, with the repository gates (spotless / 
checkstyle / RAT) green.
* Zero behavior change, certified at the artifact level: fat jars verified to 
still shade the complete compat class set (checked class-by-class on both 
lines), jar-level comparison against the pre-refactor artifacts of each line.
* The guava mechanism is untouched (see 5.2).
* Every PR lands on a green, releasable tree - no intermediate states, each 
commit independently revertable.

h2. 5. Non-goals

h3. 5.1 Flink 2.3 support

Out of scope. The series prepares the structure; a future 2.3 lands as one thin 
module plus wiring.

h3. 5.2 Guava self-shading

Dropped after review. The current mechanism already supports both generations: 
main code compiles against the 1.x shaded guava on both lines 
({{shaded.guava.version}} is never switched), the SQL fat jars bundle their own 
guava31, the flink2-line dist carries the generation-specific guava, and the 
flink2 runtime relies on the guava31 compatibility bundle flink-cdc itself 
contributed to Flink 2.2 (FLINK-39288). Restart trigger, if it ever 
materializes: the guava prefix drifts again or Flink drops that bundle - then 
self-shading has a hard reason.

h3. 5.3 Tutorial-page refresh

The tutorial download tables need a separate docs pass and are tracked 
separately.

h2. 6. Status

S1 is implemented and verified (dual-generation builds, fat-jar class-set 
assertions on both lines, no stale references); it lands via the revised PR 
#4623. S2 - S7 follow in order, one branch per sub-task.


  was:
h1. Multi-Flink-version compatibility refactor

{panel:title=Status}
Restructured into a series of small, independently mergeable sub-task PRs after 
the first review round found the original single PR too large to review ([PR 
#4623|https://github.com/apache/flink-cdc/pull/4623]). This ticket is the 
umbrella: motivation, series plan, global invariants, and the explicit 
non-goals. The sub-tasks are created under this ticket, one branch and one PR 
each.
{panel}

h2. 1. Goal

Reorganize the Flink version compatibility layer into the per-version layout 
used by Paimon and Fluss, so that supporting an additional Flink version stops 
being "a full build-configuration round plus profile surgery" and becomes "one 
thin module plus wiring". This is a pure structural refactor: no behavior 
change, no new Flink version, no guava change.

h2. 2. The reference shape

* *Paimon*: {{paimon-flink-common}} + {{paimon-flink1-common}} / 
{{paimon-flink2-common}} + one module per supported minor ({{paimon-flink-1.16 
... 1.20}}, {{2.0 ... 2.2}}); every per-version module pins its own 
{{flink.version}}; the newest modules are empty shells that only pin the 
version and produce the per-version jar.
* *Fluss*: {{fluss-flink-common}} + {{fluss-flink-1.18 / 1.19 / 1.20 / 2.2 / 
2.3}}; the 2.x modules carry a handful of same-FQCN adapter classes that 
override the common ones at shade time - supporting Flink 2.3 cost exactly one 
new adapter class.
* Both keep the compatibility layer as the only version-sensitive surface; 
flink-cdc's {{org.apache.flink.*}} backport classes in the 1.20 module are the 
same pattern Fluss uses for its older lines.

h2. 3. The series

|| # || Sub-task || Scope ||
| 1 | Rename the compat modules to version-specific names | 
{{flink-cdc-flink1-compat}} -> {{flink-cdc-flink/flink-cdc-flink-1.20}}, 
{{flink-cdc-flink2-compat}} -> {{flink-cdc-flink/flink-cdc-flink-2.2}}; pure 
rename, ~70 changed lines |
| 2 | Consolidate generation switching into the root pom | the 7 module-local 
flink1/flink2 profiles move into root pom profiles; effective values unchanged 
(~350 lines removed) |
| 3 | Split the compat layer into generation-common and line-pinned thin 
modules | {{flink-cdc-flink1-common}} / {{flink-cdc-flink2-common}} hold the 
classes; thin {{flink-cdc-flink-1.20}} / {{-2.2}} pin their line |
| 4 | Replace main-code reflection into Flink internals with compat adapters | 
SinkWriterOperator probing, StreamExecutionEnvironment.configuration, dead 
reflection; 17 files |
| 5 | Per-version dist from a line-parameterized dist module | 
{{flink-cdc-dist-flink-<line>}}, Yarn dist-jar lookup at runtime, 
release-script adaptation |
| 6 | Per-version connector fat jars from line-parameterized modules | 9 SQL 
connectors + the 4 generation-forked pipeline connectors; the other 11 keep a 
single GAV |
| 7 | Docs refresh for the per-version artifact naming | EN + zh GAV tables and 
naming notes |

An optional follow-up outside the series: stop assembling the starrocks / hudi 
fat jars under the flink2 build (their shaded external SDKs only exist for the 
1.x line).

h2. 4. Global invariants (acceptance bar for every sub-task)

* Both generations build green: full {{mvn clean install -DskipTests}} on the 
default profile and on {{-Pflink2}}, with the repository gates (spotless / 
checkstyle / RAT) green.
* Zero behavior change, certified at the artifact level: fat jars verified to 
still shade the complete compat class set (checked class-by-class on both 
lines), jar-level comparison against the pre-refactor artifacts of each line.
* The guava mechanism is untouched (see 5.2).
* Every PR lands on a green, releasable tree - no intermediate states, each 
commit independently revertable.

h2. 5. Non-goals

h3. 5.1 Flink 2.3 support

Out of scope. The series prepares the structure; a future 2.3 lands as one thin 
module plus wiring.

h3. 5.2 Guava self-shading

Dropped after review. The current mechanism already supports both generations: 
main code compiles against the 1.x shaded guava on both lines 
({{shaded.guava.version}} is never switched), the SQL fat jars bundle their own 
guava31, the flink2-line dist carries the generation-specific guava, and the 
flink2 runtime relies on the guava31 compatibility bundle flink-cdc itself 
contributed to Flink 2.2 (FLINK-39288). Restart trigger, if it ever 
materializes: the guava prefix drifts again or Flink drops that bundle - then 
self-shading has a hard reason.

h3. 5.3 Tutorial-page refresh

The tutorial download tables need a separate docs pass and are tracked 
separately.

h2. 6. Status

S1 is implemented and verified (dual-generation builds, fat-jar class-set 
assertions on both lines, no stale references); it lands via the revised PR 
#4623. S2 - S7 follow in order, one branch per sub-task.



> Multi-Flink-version compatibility refactor
> ------------------------------------------
>
>                 Key: FLINK-41452
>                 URL: https://issues.apache.org/jira/browse/FLINK-41452
>             Project: Flink
>          Issue Type: Improvement
>          Components: Flink CDC
>    Affects Versions: cdc-3.7.0
>            Reporter: peiyu
>            Priority: Major
>              Labels: pull-request-available
>
> h1. Multi-Flink-version compatibility refactor
> {panel:title=Status}
> Restructured into a series of small, independently mergeable sub-task PRs 
> after the first review round found the original single PR too large to review 
> ([PR #4623|https://github.com/apache/flink-cdc/pull/4623]). This ticket is 
> the umbrella: motivation, series plan, global invariants, and the explicit 
> non-goals. The sub-tasks are created under this ticket, one branch and one PR 
> each.
> {panel}
> h2. 1. Goal
> Reorganize the Flink version compatibility layer into the per-version layout 
> used by Paimon and Fluss, so that supporting an additional Flink version 
> stops being "a full build-configuration round plus profile surgery" and 
> becomes "one thin module plus wiring". This is a pure structural refactor: no 
> behavior change, no new Flink version, no guava change.
> h2. 2. The reference shape
> * *Paimon*: {{paimon-flink-common}} + {{paimon-flink1-common}} / 
> {{paimon-flink2-common}} + one module per supported minor 
> ({{paimon-flink-1.16 ... 1.20}}, {{2.0 ... 2.2}}); every per-version module 
> pins its own {{flink.version}}; the newest modules are empty shells that only 
> pin the version and produce the per-version jar.
> * *Fluss*: {{fluss-flink-common}} + {{fluss-flink-1.18 / 1.19 / 1.20 / 2.2 / 
> 2.3}}; the 2.x modules carry a handful of same-FQCN adapter classes that 
> override the common ones at shade time - supporting Flink 2.3 cost exactly 
> one new adapter class.
> * Both keep the compatibility layer as the only version-sensitive surface; 
> flink-cdc's {{org.apache.flink.*}} backport classes in the 1.20 module are 
> the same pattern Fluss uses for its older lines.
> h2. 3. The series
> || # || Sub-task || Scope ||
> | 1 | Rename the compat modules to version-specific names | 
> {{flink-cdc-flink1-compat}} -> {{flink-cdc-compat/flink-cdc-flink-1.20}}, 
> {{flink-cdc-flink2-compat}} -> {{flink-cdc-compat/flink-cdc-flink-2.2}}; pure 
> rename, ~70 changed lines |
> | 2 | Consolidate generation switching into the root pom | the 7 module-local 
> flink1/flink2 profiles move into root pom profiles; effective values 
> unchanged (~350 lines removed) |
> | 3 | Split the compat layer into generation-common and line-pinned thin 
> modules | {{flink-cdc-flink1-common}} / {{flink-cdc-flink2-common}} hold the 
> classes; thin {{flink-cdc-flink-1.20}} / {{-2.2}} pin their line |
> | 4 | Replace main-code reflection into Flink internals with compat adapters 
> | SinkWriterOperator probing, StreamExecutionEnvironment.configuration, dead 
> reflection; 17 files |
> | 5 | Per-version dist from a line-parameterized dist module | 
> {{flink-cdc-dist-flink-<line>}}, Yarn dist-jar lookup at runtime, 
> release-script adaptation |
> | 6 | Per-version connector fat jars from line-parameterized modules | 9 SQL 
> connectors + the 4 generation-forked pipeline connectors; the other 11 keep a 
> single GAV |
> | 7 | Docs refresh for the per-version artifact naming | EN + zh GAV tables 
> and naming notes |
> An optional follow-up outside the series: stop assembling the starrocks / 
> hudi fat jars under the flink2 build (their shaded external SDKs only exist 
> for the 1.x line).
> h2. 4. Global invariants (acceptance bar for every sub-task)
> * Both generations build green: full {{mvn clean install -DskipTests}} on the 
> default profile and on {{-Pflink2}}, with the repository gates (spotless / 
> checkstyle / RAT) green.
> * Zero behavior change, certified at the artifact level: fat jars verified to 
> still shade the complete compat class set (checked class-by-class on both 
> lines), jar-level comparison against the pre-refactor artifacts of each line.
> * The guava mechanism is untouched (see 5.2).
> * Every PR lands on a green, releasable tree - no intermediate states, each 
> commit independently revertable.
> h2. 5. Non-goals
> h3. 5.1 Flink 2.3 support
> Out of scope. The series prepares the structure; a future 2.3 lands as one 
> thin module plus wiring.
> h3. 5.2 Guava self-shading
> Dropped after review. The current mechanism already supports both 
> generations: main code compiles against the 1.x shaded guava on both lines 
> ({{shaded.guava.version}} is never switched), the SQL fat jars bundle their 
> own guava31, the flink2-line dist carries the generation-specific guava, and 
> the flink2 runtime relies on the guava31 compatibility bundle flink-cdc 
> itself contributed to Flink 2.2 (FLINK-39288). Restart trigger, if it ever 
> materializes: the guava prefix drifts again or Flink drops that bundle - then 
> self-shading has a hard reason.
> h3. 5.3 Tutorial-page refresh
> The tutorial download tables need a separate docs pass and are tracked 
> separately.
> h2. 6. Status
> S1 is implemented and verified (dual-generation builds, fat-jar class-set 
> assertions on both lines, no stale references); it lands via the revised PR 
> #4623. S2 - S7 follow in order, one branch per sub-task.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to