[
https://issues.apache.org/jira/browse/FLINK-41641?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
peiyu updated FLINK-41641:
--------------------------
Description:
================================================================
Sub-task S1 (created: FLINK-41641)
Summary: Rename the Flink compat modules to version-specific names
================================================================
h2. Purpose
Name the compatibility modules after the Flink version they target, and nest
them under a flink-cdc-compat aggregate, so future Flink lines can grow as
sibling modules - the layout used by Paimon (paimon-flink-1.20 ...) and Fluss
(fluss-flink-1.20 ...).
h2. Changes
Pure rename, zero class-content change:
* {{flink-cdc-flink1-compat}} -> {{flink-cdc-compat/flink-cdc-flink-1.20}}
* {{flink-cdc-flink2-compat}} -> {{flink-cdc-compat/flink-cdc-flink-2.2}}
* New aggregate pom {{flink-cdc-compat/pom.xml}} (packaging pom, two modules).
* Reference updates (17 files, a few lines each): root pom {{<modules>}}; the
compat dependency declarations, neutralization profiles and test-classpath copy
steps in cli / common / composer / runtime / dist / connect /
source-connectors; the shade include wildcard in the 7 SQL connector fat jar
poms ({{flink-cdc-flink*-compat}} -> {{flink-cdc-flink-*}}); the javadoc
exclusion list in docs.sh (switched to relative paths - bare artifactIds only
match root-level modules); AGENTS.md.
h2. Non-goals
No profile id, property or behavior change; guava handling untouched; CI
untouched (no workflow references a compat module name); download-page GAVs
untouched.
h2. Verification
Full clean install on JDK 11 for both generations (default and {{-Pflink2}}),
repository gates green. Every fat jar was checked to still shade the complete
compat class set: the dist and SQL connector fat jars on both lines (21 / 38
classes, none missing). No reference to the old module names remains in the
tree.
h2. Dependencies
None - first step of the series.
================================================================
Sub-task S2 (created: FLINK-41642)
Summary: Consolidate Flink generation switching into the root pom
================================================================
h2. Purpose
Make the root pom the single generation switch point. Today the 1.20-vs-2.2
switching is scattered across the local flink1/flink2 profiles of 7 modules
(~350 lines of duplication); after this sub-task a module carries zero local
generation profiles.
h2. Changes
* The root pom gains {{flink1}} (activeByDefault) / {{flink2}} profiles
centralizing {{flink.version}}, {{flink.compat.artifactId}} and the external
connector versions (kafka / elasticsearch / paimon / iceberg / fluss).
* The local profiles in cli, common, composer, runtime, dist, connect and
source-connectors are deleted; the modules keep an unconditional dependency on
${{{flink.compat.artifactId}}} (the root pom itself must not declare it - the
compat modules are part of the reactor and would inherit a dependency on
themselves).
* Effective values unchanged by construction: every moved property is compared
before/after with {{mvn help:evaluate}} on both profiles.
h2. Preserved as-is (the guava mechanism)
* The root {{flink2}} profile keeps the {{copy-flink2-guava}} execution and the
surefire {{additionalClasspathElement}} + {{flink.profile=flink2}} system
property.
* connect keeps {{copy-flink2-extra-libs}} and the {{*:*}}-exclusion
neutralization declarations; runtime keeps {{flink2-exclude-flink1}}.
* dist keeps its module-local, generation-specific guava dependency -
{{shaded.guava.version}} must never be switched globally, or the 89 {{guava31}}
imports stop compiling.
h2. Verification
Dual-generation full builds; {{-Pflink2}} unit tests must still run (proves the
guava33 test classpath survived); fat jars byte-identical (pure property move).
h2. Dependencies
After the rename sub-task (module names); otherwise independent.
================================================================
Sub-task S3
Summary: Split the compat layer into generation-common and line-pinned thin
modules
================================================================
h2. Purpose
Adopt the Paimon layering: generation-common modules hold the compatibility
code, and one thin module per supported minor pins its Flink line. Supporting a
future Flink version then means one thin module plus root-pom wiring - the
common layers and all connectors stay untouched. (Paimon's newest
{{paimon-flink-1.20}} / {{-2.2}} modules are empty shells for exactly this
reason; Fluss supports 2.3 with a single adapter class.)
h2. Changes
* All classes move from {{flink-cdc-compat/flink-cdc-flink-1.20}} to a new
{{flink-cdc-compat/flink-cdc-flink1-common}} (pure move, zero class-content
change); likewise the 2.2 side -> {{flink-cdc-flink2-common}}.
{{flink.compat.artifactId}} then points at the common modules.
* New thin modules {{flink-cdc-flink-1.20}} / {{flink-cdc-flink-2.2}}: a pom
pinning {{flink.version}} to new root properties {{flink.1.20.version}} /
{{flink.2.2.version}} (so a generation-baseline bump cannot drag an older line
along) and a compile dependency on the matching common module. Skeletons only -
no classes, no tests.
h2. Non-goals
No fat-jar rewiring yet: the dist and SQL connector modules start depending on
the thin modules in the per-version artifact sub-tasks, which is what makes
"add a version" zero-touch. No override or priority probe tests - the same-FQCN
override (Fluss's mechanism) is only exercised when a real version difference
exists.
h2. Verification
Dual-generation full builds; fat jars still shade the complete compat class set
(the classes move between modules, the FQCNs do not change); jar-level
comparison shows class content identical.
h2. Dependencies
After the rename sub-task.
================================================================
Sub-task S4
Summary: Replace main-code reflection into Flink internals with compat adapters
================================================================
h2. Purpose
Remove the silent upgrade breakage points: main code currently reflects into
{{org.apache.flink}} internals. Fluss solves the same problem structurally -
zero Flink-internal reflection in main code, all version sensitivity in the
compatibility layer - and that is the shape this sub-task adopts.
h2. Changes
* The three-segment {{SinkWriterOperator}} reflection in the sink operators
(3-arg / 4-arg constructor probing, setup visibility, private {{sinkWriter}}
field) -> per-generation {{SinkWriterOperatorAdapter}} in the compat modules
(same-package bridge: direct access to package-private / protected members, the
remaining field reflection concentrated in one place).
* The composer's private-field reflection on
{{StreamExecutionEnvironment.configuration}} -> per-generation
{{StreamExecutionEnvironmentAdapter}}; the legacy {{addSource}} call sites
route through it as well.
* Dead reflection removed by direct calls: {{MySqlSource.metricGroup}} and the
{{PreTransformOperator}} {{Class.forName}} probe - both APIs are stable on both
generations.
* Legacy {{SinkFunction}} / {{SourceFunction}} call sites (moved to the legacy
subpackage by 2.x) route through {{StreamSinkAdapter}};
{{RuntimeContextAdapter}}'s signature narrowed to the minimal common interface.
* 8 call-site files and 7 new/adjusted adapter classes, 17 files in total.
h2. Non-goals
No bytecode-scan guard - neither Paimon nor Fluss carries such a test, and the
adapters are the structural fix. No behavior change (side effect: the composer
jar becomes byte-identical across generations).
h2. Verification
Dual-generation builds + unit tests of the affected modules; the reflection
sites are gone from the built classes.
h2. Dependencies
After the compat-layer split (the adapters live in the common modules).
================================================================
Sub-task S5
Summary: Produce the per-version dist from a line-parameterized dist module
================================================================
h2. Purpose
One dist module produces the distribution of whichever Flink line is being
built: {{flink-cdc-dist-flink-1.20}} / {{flink-cdc-dist-flink-2.2}} and the
{{flink-cdc-<version>-flink-<line>-bin}} tarball - the Paimon/Fluss artifact
shape, where the artifactId carries the line and the version string stays
clean. No per-line module clones, no gating properties.
h2. Changes
* New root property {{flink.line}} (default 1.20, {{flink2}} profile -> 2.2);
the dist artifactId becomes {{flink-cdc-dist-flink-${{{flink.line}}}}} and the
assembly finalName follows.
* The Yarn dist-jar lookup derives the Flink line at runtime from the running
jar's own name ({{flink-cdc-dist-flink-<ver>-*.jar}}, legacy names understood,
unidentifiable shapes fail loudly) instead of the build-time filtered resource:
a single build-time value cannot serve two same-generation releases, while
self-identifying jars always answer for themselves. Side effect: the composer
jar becomes generation-neutral.
* The dist additionally depends on the thin module
{{flink-cdc-flink-${{{flink.line}}}}} (compile), so a future thin-module class
wins the shade priority over the common module.
* Release script: two-line invocation + transition-period legacy-named
artifacts; update_version.sh, Dockerfile ARG, .gitignore
({{release-artifacts/}}), pipeline-e2e dist selection via a
{{flink.dist.artifactId}} property.
* Preserved as-is: the dist keeps its generation-specific guava dependency
(module-local, as today).
h2. Verification
Dual-generation builds; jar-level comparison of the dist fat jar against the
pre-refactor artifact of the matching line (class content identical, GAV
metadata aside); Yarn lookup unit tests (exact / generation mismatch /
ambiguity / legacy fallback); e2e via CI.
h2. Dependencies
After the compat-layer split (thin modules exist). Independent of the
reflection sub-task.
================================================================
Sub-task S6
Summary: Produce per-version connector fat jars from line-parameterized modules
================================================================
h2. Purpose
The 9 SQL source connector fat jars and the 4 pipeline connectors whose shaded
external dependency lines fork across generations (kafka, paimon,
elasticsearch, iceberg) become single line-parameterized modules:
{{flink-sql-connector-<X>-cdc${{{source.fatjar.suffix}}}}} /
{{flink-cdc-pipeline-connector-<X>${{{pipeline.fatjar.suffix}}}}}. One module,
one shade configuration, no per-line clones.
The other 11 pipeline connector fat jars keep a single GAV: a jar-level scan of
all 15 pipeline connectors proved their content cross-generation equivalent
(annotation / metadata-only differences, or byte-identical). Repository
invariant: no artifact whose content varies across generations while its GAV
carries no generation identity.
h2. Changes
* Root properties {{source.fatjar.suffix}} / {{pipeline.fatjar.suffix}} =
{{-flink-${{{flink.line}}}}}; 13 connector poms parameterize their artifactId.
* The fat-jar modules depend on the thin module
{{flink-cdc-flink-${{{flink.line}}}}} (compile).
* license_check.rb jar-name matching; source-e2e fat jar selection from the
line property; a new CI job running the source e2e on the 2.2 line.
* Release script finalized: the flink1 line deploys everything exactly once;
the flink2 line installs fully, then deploys a {{-pl}}-restricted per-version
list (no {{-am}} - a second deploy of shared GAVs would be rejected by Nexus
staging, protectively so).
* 2.x-line jdbc coordinates adapted ({{flink-connector-jdbc-core}} + the split
dialect jar).
h2. Verification
Dual-generation builds; jar-level comparison of every per-version fat jar
against the pre-refactor artifact of its line (the 4 pipeline fat jars each
drop exactly the placeholder class the old per-line shells contributed; the SQL
and dist fat jars are byte-identical); e2e on both lines via CI.
h2. Dependencies
After the dist sub-task ({{flink.line}}).
================================================================
Sub-task S7
Summary: Refresh the docs for the per-version artifact naming
================================================================
h2. Purpose
Align the documentation with the artifact coordinates introduced by the dist
and connector sub-tasks, in both languages.
h2. Changes
* README artifact-naming notes; the download tables (GAV column) of the source
and pipeline connector overview pages; the DataStream packaging guidance pom
examples; the FAQ artifact-name examples.
* A short "which jar do I pick" note per version line.
* EN and zh updated together (~29 pages).
h2. Non-goals
The tutorial pages (mysql-to-kafka, migrate-paimon-cdc-action, ...) need a
full-page refresh of their download tables and are tracked separately.
h2. Dependencies
After the dist and connector sub-tasks (the names being documented must exist).
================================================================
Optional follow-up (outside the series)
Summary: Skip the starrocks and hudi fat jars under the flink2 build
================================================================
h2. Purpose
The starrocks and hudi shaded external SDKs are only published for the Flink
1.x line; under {{-Pflink2}} the fat jars are assembled anyway from the
1.20-line SDK - artifacts labeled flink2 that cannot work on Flink 2.x.
h2. Changes
{{connector.generation.skip=true}} in the root {{flink2}} profile;
{{<skip>${{{connector.generation.skip}}}</skip>}} on the shade executions of
the two modules; the CI flink2 matrix drops starrocks; a README note. The
modules still compile and run their tests on the flink2 line - only the fat jar
is skipped.
h2. Note
The only behavioral change in the whole effort; submitted separately and only
with maintainer sign-off.
was:
================================================================
Sub-task S1 (created: FLINK-41641)
Summary: Rename the Flink compat modules to version-specific names
================================================================
h2. Purpose
Name the compatibility modules after the Flink version they target, and nest
them under a flink-cdc-compat aggregate, so future Flink lines can grow as
sibling modules - the layout used by Paimon (paimon-flink-1.20 ...) and Fluss
(fluss-flink-1.20 ...).
h2. Changes
Pure rename, zero class-content change:
* {{flink-cdc-flink1-compat}} -> {{flink-cdc-compat/flink-cdc-flink-1.20}}
* {{flink-cdc-flink2-compat}} -> {{flink-cdc-compat/flink-cdc-flink-2.2}}
* New aggregate pom {{flink-cdc-flink/pom.xml}} (packaging pom, two modules).
* Reference updates (17 files, a few lines each): root pom {{<modules>}}; the
compat dependency declarations, neutralization profiles and test-classpath copy
steps in cli / common / composer / runtime / dist / connect /
source-connectors; the shade include wildcard in the 7 SQL connector fat jar
poms ({{flink-cdc-flink*-compat}} -> {{flink-cdc-flink-*}}); the javadoc
exclusion list in docs.sh (switched to relative paths - bare artifactIds only
match root-level modules); AGENTS.md.
h2. Non-goals
No profile id, property or behavior change; guava handling untouched; CI
untouched (no workflow references a compat module name); download-page GAVs
untouched.
h2. Verification
Full clean install on JDK 11 for both generations (default and {{-Pflink2}}),
repository gates green. Every fat jar was checked to still shade the complete
compat class set: the dist and SQL connector fat jars on both lines (21 / 38
classes, none missing). No reference to the old module names remains in the
tree.
h2. Dependencies
None - first step of the series.
================================================================
Sub-task S2 (created: FLINK-41642)
Summary: Consolidate Flink generation switching into the root pom
================================================================
h2. Purpose
Make the root pom the single generation switch point. Today the 1.20-vs-2.2
switching is scattered across the local flink1/flink2 profiles of 7 modules
(~350 lines of duplication); after this sub-task a module carries zero local
generation profiles.
h2. Changes
* The root pom gains {{flink1}} (activeByDefault) / {{flink2}} profiles
centralizing {{flink.version}}, {{flink.compat.artifactId}} and the external
connector versions (kafka / elasticsearch / paimon / iceberg / fluss).
* The local profiles in cli, common, composer, runtime, dist, connect and
source-connectors are deleted; the modules keep an unconditional dependency on
${{{flink.compat.artifactId}}} (the root pom itself must not declare it - the
compat modules are part of the reactor and would inherit a dependency on
themselves).
* Effective values unchanged by construction: every moved property is compared
before/after with {{mvn help:evaluate}} on both profiles.
h2. Preserved as-is (the guava mechanism)
* The root {{flink2}} profile keeps the {{copy-flink2-guava}} execution and the
surefire {{additionalClasspathElement}} + {{flink.profile=flink2}} system
property.
* connect keeps {{copy-flink2-extra-libs}} and the {{*:*}}-exclusion
neutralization declarations; runtime keeps {{flink2-exclude-flink1}}.
* dist keeps its module-local, generation-specific guava dependency -
{{shaded.guava.version}} must never be switched globally, or the 89 {{guava31}}
imports stop compiling.
h2. Verification
Dual-generation full builds; {{-Pflink2}} unit tests must still run (proves the
guava33 test classpath survived); fat jars byte-identical (pure property move).
h2. Dependencies
After the rename sub-task (module names); otherwise independent.
================================================================
Sub-task S3
Summary: Split the compat layer into generation-common and line-pinned thin
modules
================================================================
h2. Purpose
Adopt the Paimon layering: generation-common modules hold the compatibility
code, and one thin module per supported minor pins its Flink line. Supporting a
future Flink version then means one thin module plus root-pom wiring - the
common layers and all connectors stay untouched. (Paimon's newest
{{paimon-flink-1.20}} / {{-2.2}} modules are empty shells for exactly this
reason; Fluss supports 2.3 with a single adapter class.)
h2. Changes
* All classes move from {{flink-cdc-compat/flink-cdc-flink-1.20}} to a new
{{flink-cdc-compat/flink-cdc-flink1-common}} (pure move, zero class-content
change); likewise the 2.2 side -> {{flink-cdc-flink2-common}}.
{{flink.compat.artifactId}} then points at the common modules.
* New thin modules {{flink-cdc-flink-1.20}} / {{flink-cdc-flink-2.2}}: a pom
pinning {{flink.version}} to new root properties {{flink.1.20.version}} /
{{flink.2.2.version}} (so a generation-baseline bump cannot drag an older line
along) and a compile dependency on the matching common module. Skeletons only -
no classes, no tests.
h2. Non-goals
No fat-jar rewiring yet: the dist and SQL connector modules start depending on
the thin modules in the per-version artifact sub-tasks, which is what makes
"add a version" zero-touch. No override or priority probe tests - the same-FQCN
override (Fluss's mechanism) is only exercised when a real version difference
exists.
h2. Verification
Dual-generation full builds; fat jars still shade the complete compat class set
(the classes move between modules, the FQCNs do not change); jar-level
comparison shows class content identical.
h2. Dependencies
After the rename sub-task.
================================================================
Sub-task S4
Summary: Replace main-code reflection into Flink internals with compat adapters
================================================================
h2. Purpose
Remove the silent upgrade breakage points: main code currently reflects into
{{org.apache.flink}} internals. Fluss solves the same problem structurally -
zero Flink-internal reflection in main code, all version sensitivity in the
compatibility layer - and that is the shape this sub-task adopts.
h2. Changes
* The three-segment {{SinkWriterOperator}} reflection in the sink operators
(3-arg / 4-arg constructor probing, setup visibility, private {{sinkWriter}}
field) -> per-generation {{SinkWriterOperatorAdapter}} in the compat modules
(same-package bridge: direct access to package-private / protected members, the
remaining field reflection concentrated in one place).
* The composer's private-field reflection on
{{StreamExecutionEnvironment.configuration}} -> per-generation
{{StreamExecutionEnvironmentAdapter}}; the legacy {{addSource}} call sites
route through it as well.
* Dead reflection removed by direct calls: {{MySqlSource.metricGroup}} and the
{{PreTransformOperator}} {{Class.forName}} probe - both APIs are stable on both
generations.
* Legacy {{SinkFunction}} / {{SourceFunction}} call sites (moved to the legacy
subpackage by 2.x) route through {{StreamSinkAdapter}};
{{RuntimeContextAdapter}}'s signature narrowed to the minimal common interface.
* 8 call-site files and 7 new/adjusted adapter classes, 17 files in total.
h2. Non-goals
No bytecode-scan guard - neither Paimon nor Fluss carries such a test, and the
adapters are the structural fix. No behavior change (side effect: the composer
jar becomes byte-identical across generations).
h2. Verification
Dual-generation builds + unit tests of the affected modules; the reflection
sites are gone from the built classes.
h2. Dependencies
After the compat-layer split (the adapters live in the common modules).
================================================================
Sub-task S5
Summary: Produce the per-version dist from a line-parameterized dist module
================================================================
h2. Purpose
One dist module produces the distribution of whichever Flink line is being
built: {{flink-cdc-dist-flink-1.20}} / {{flink-cdc-dist-flink-2.2}} and the
{{flink-cdc-<version>-flink-<line>-bin}} tarball - the Paimon/Fluss artifact
shape, where the artifactId carries the line and the version string stays
clean. No per-line module clones, no gating properties.
h2. Changes
* New root property {{flink.line}} (default 1.20, {{flink2}} profile -> 2.2);
the dist artifactId becomes {{flink-cdc-dist-flink-${{{flink.line}}}}} and the
assembly finalName follows.
* The Yarn dist-jar lookup derives the Flink line at runtime from the running
jar's own name ({{flink-cdc-dist-flink-<ver>-*.jar}}, legacy names understood,
unidentifiable shapes fail loudly) instead of the build-time filtered resource:
a single build-time value cannot serve two same-generation releases, while
self-identifying jars always answer for themselves. Side effect: the composer
jar becomes generation-neutral.
* The dist additionally depends on the thin module
{{flink-cdc-flink-${{{flink.line}}}}} (compile), so a future thin-module class
wins the shade priority over the common module.
* Release script: two-line invocation + transition-period legacy-named
artifacts; update_version.sh, Dockerfile ARG, .gitignore
({{release-artifacts/}}), pipeline-e2e dist selection via a
{{flink.dist.artifactId}} property.
* Preserved as-is: the dist keeps its generation-specific guava dependency
(module-local, as today).
h2. Verification
Dual-generation builds; jar-level comparison of the dist fat jar against the
pre-refactor artifact of the matching line (class content identical, GAV
metadata aside); Yarn lookup unit tests (exact / generation mismatch /
ambiguity / legacy fallback); e2e via CI.
h2. Dependencies
After the compat-layer split (thin modules exist). Independent of the
reflection sub-task.
================================================================
Sub-task S6
Summary: Produce per-version connector fat jars from line-parameterized modules
================================================================
h2. Purpose
The 9 SQL source connector fat jars and the 4 pipeline connectors whose shaded
external dependency lines fork across generations (kafka, paimon,
elasticsearch, iceberg) become single line-parameterized modules:
{{flink-sql-connector-<X>-cdc${{{source.fatjar.suffix}}}}} /
{{flink-cdc-pipeline-connector-<X>${{{pipeline.fatjar.suffix}}}}}. One module,
one shade configuration, no per-line clones.
The other 11 pipeline connector fat jars keep a single GAV: a jar-level scan of
all 15 pipeline connectors proved their content cross-generation equivalent
(annotation / metadata-only differences, or byte-identical). Repository
invariant: no artifact whose content varies across generations while its GAV
carries no generation identity.
h2. Changes
* Root properties {{source.fatjar.suffix}} / {{pipeline.fatjar.suffix}} =
{{-flink-${{{flink.line}}}}}; 13 connector poms parameterize their artifactId.
* The fat-jar modules depend on the thin module
{{flink-cdc-flink-${{{flink.line}}}}} (compile).
* license_check.rb jar-name matching; source-e2e fat jar selection from the
line property; a new CI job running the source e2e on the 2.2 line.
* Release script finalized: the flink1 line deploys everything exactly once;
the flink2 line installs fully, then deploys a {{-pl}}-restricted per-version
list (no {{-am}} - a second deploy of shared GAVs would be rejected by Nexus
staging, protectively so).
* 2.x-line jdbc coordinates adapted ({{flink-connector-jdbc-core}} + the split
dialect jar).
h2. Verification
Dual-generation builds; jar-level comparison of every per-version fat jar
against the pre-refactor artifact of its line (the 4 pipeline fat jars each
drop exactly the placeholder class the old per-line shells contributed; the SQL
and dist fat jars are byte-identical); e2e on both lines via CI.
h2. Dependencies
After the dist sub-task ({{flink.line}}).
================================================================
Sub-task S7
Summary: Refresh the docs for the per-version artifact naming
================================================================
h2. Purpose
Align the documentation with the artifact coordinates introduced by the dist
and connector sub-tasks, in both languages.
h2. Changes
* README artifact-naming notes; the download tables (GAV column) of the source
and pipeline connector overview pages; the DataStream packaging guidance pom
examples; the FAQ artifact-name examples.
* A short "which jar do I pick" note per version line.
* EN and zh updated together (~29 pages).
h2. Non-goals
The tutorial pages (mysql-to-kafka, migrate-paimon-cdc-action, ...) need a
full-page refresh of their download tables and are tracked separately.
h2. Dependencies
After the dist and connector sub-tasks (the names being documented must exist).
================================================================
Optional follow-up (outside the series)
Summary: Skip the starrocks and hudi fat jars under the flink2 build
================================================================
h2. Purpose
The starrocks and hudi shaded external SDKs are only published for the Flink
1.x line; under {{-Pflink2}} the fat jars are assembled anyway from the
1.20-line SDK - artifacts labeled flink2 that cannot work on Flink 2.x.
h2. Changes
{{connector.generation.skip=true}} in the root {{flink2}} profile;
{{<skip>${{{connector.generation.skip}}}</skip>}} on the shade executions of
the two modules; the CI flink2 matrix drops starrocks; a README note. The
modules still compile and run their tests on the flink2 line - only the fat jar
is skipped.
h2. Note
The only behavioral change in the whole effort; submitted separately and only
with maintainer sign-off.
> Rename the Flink compat modules to version-specific names
> ---------------------------------------------------------
>
> Key: FLINK-41641
> URL: https://issues.apache.org/jira/browse/FLINK-41641
> Project: Flink
> Issue Type: Sub-task
> Components: Flink CDC
> Affects Versions: cdc-3.7.0
> Reporter: peiyu
> Priority: Major
> Labels: pull-request-available
>
> ================================================================
> Sub-task S1 (created: FLINK-41641)
> Summary: Rename the Flink compat modules to version-specific names
> ================================================================
> h2. Purpose
> Name the compatibility modules after the Flink version they target, and nest
> them under a flink-cdc-compat aggregate, so future Flink lines can grow as
> sibling modules - the layout used by Paimon (paimon-flink-1.20 ...) and Fluss
> (fluss-flink-1.20 ...).
> h2. Changes
> Pure rename, zero class-content change:
> * {{flink-cdc-flink1-compat}} -> {{flink-cdc-compat/flink-cdc-flink-1.20}}
> * {{flink-cdc-flink2-compat}} -> {{flink-cdc-compat/flink-cdc-flink-2.2}}
> * New aggregate pom {{flink-cdc-compat/pom.xml}} (packaging pom, two modules).
> * Reference updates (17 files, a few lines each): root pom {{<modules>}}; the
> compat dependency declarations, neutralization profiles and test-classpath
> copy steps in cli / common / composer / runtime / dist / connect /
> source-connectors; the shade include wildcard in the 7 SQL connector fat jar
> poms ({{flink-cdc-flink*-compat}} -> {{flink-cdc-flink-*}}); the javadoc
> exclusion list in docs.sh (switched to relative paths - bare artifactIds only
> match root-level modules); AGENTS.md.
> h2. Non-goals
> No profile id, property or behavior change; guava handling untouched; CI
> untouched (no workflow references a compat module name); download-page GAVs
> untouched.
> h2. Verification
> Full clean install on JDK 11 for both generations (default and {{-Pflink2}}),
> repository gates green. Every fat jar was checked to still shade the complete
> compat class set: the dist and SQL connector fat jars on both lines (21 / 38
> classes, none missing). No reference to the old module names remains in the
> tree.
> h2. Dependencies
> None - first step of the series.
> ================================================================
> Sub-task S2 (created: FLINK-41642)
> Summary: Consolidate Flink generation switching into the root pom
> ================================================================
> h2. Purpose
> Make the root pom the single generation switch point. Today the 1.20-vs-2.2
> switching is scattered across the local flink1/flink2 profiles of 7 modules
> (~350 lines of duplication); after this sub-task a module carries zero local
> generation profiles.
> h2. Changes
> * The root pom gains {{flink1}} (activeByDefault) / {{flink2}} profiles
> centralizing {{flink.version}}, {{flink.compat.artifactId}} and the external
> connector versions (kafka / elasticsearch / paimon / iceberg / fluss).
> * The local profiles in cli, common, composer, runtime, dist, connect and
> source-connectors are deleted; the modules keep an unconditional dependency
> on ${{{flink.compat.artifactId}}} (the root pom itself must not declare it -
> the compat modules are part of the reactor and would inherit a dependency on
> themselves).
> * Effective values unchanged by construction: every moved property is
> compared before/after with {{mvn help:evaluate}} on both profiles.
> h2. Preserved as-is (the guava mechanism)
> * The root {{flink2}} profile keeps the {{copy-flink2-guava}} execution and
> the surefire {{additionalClasspathElement}} + {{flink.profile=flink2}} system
> property.
> * connect keeps {{copy-flink2-extra-libs}} and the {{*:*}}-exclusion
> neutralization declarations; runtime keeps {{flink2-exclude-flink1}}.
> * dist keeps its module-local, generation-specific guava dependency -
> {{shaded.guava.version}} must never be switched globally, or the 89
> {{guava31}} imports stop compiling.
> h2. Verification
> Dual-generation full builds; {{-Pflink2}} unit tests must still run (proves
> the guava33 test classpath survived); fat jars byte-identical (pure property
> move).
> h2. Dependencies
> After the rename sub-task (module names); otherwise independent.
> ================================================================
> Sub-task S3
> Summary: Split the compat layer into generation-common and line-pinned thin
> modules
> ================================================================
> h2. Purpose
> Adopt the Paimon layering: generation-common modules hold the compatibility
> code, and one thin module per supported minor pins its Flink line. Supporting
> a future Flink version then means one thin module plus root-pom wiring - the
> common layers and all connectors stay untouched. (Paimon's newest
> {{paimon-flink-1.20}} / {{-2.2}} modules are empty shells for exactly this
> reason; Fluss supports 2.3 with a single adapter class.)
> h2. Changes
> * All classes move from {{flink-cdc-compat/flink-cdc-flink-1.20}} to a new
> {{flink-cdc-compat/flink-cdc-flink1-common}} (pure move, zero class-content
> change); likewise the 2.2 side -> {{flink-cdc-flink2-common}}.
> {{flink.compat.artifactId}} then points at the common modules.
> * New thin modules {{flink-cdc-flink-1.20}} / {{flink-cdc-flink-2.2}}: a pom
> pinning {{flink.version}} to new root properties {{flink.1.20.version}} /
> {{flink.2.2.version}} (so a generation-baseline bump cannot drag an older
> line along) and a compile dependency on the matching common module. Skeletons
> only - no classes, no tests.
> h2. Non-goals
> No fat-jar rewiring yet: the dist and SQL connector modules start depending
> on the thin modules in the per-version artifact sub-tasks, which is what
> makes "add a version" zero-touch. No override or priority probe tests - the
> same-FQCN override (Fluss's mechanism) is only exercised when a real version
> difference exists.
> h2. Verification
> Dual-generation full builds; fat jars still shade the complete compat class
> set (the classes move between modules, the FQCNs do not change); jar-level
> comparison shows class content identical.
> h2. Dependencies
> After the rename sub-task.
> ================================================================
> Sub-task S4
> Summary: Replace main-code reflection into Flink internals with compat
> adapters
> ================================================================
> h2. Purpose
> Remove the silent upgrade breakage points: main code currently reflects into
> {{org.apache.flink}} internals. Fluss solves the same problem structurally -
> zero Flink-internal reflection in main code, all version sensitivity in the
> compatibility layer - and that is the shape this sub-task adopts.
> h2. Changes
> * The three-segment {{SinkWriterOperator}} reflection in the sink operators
> (3-arg / 4-arg constructor probing, setup visibility, private {{sinkWriter}}
> field) -> per-generation {{SinkWriterOperatorAdapter}} in the compat modules
> (same-package bridge: direct access to package-private / protected members,
> the remaining field reflection concentrated in one place).
> * The composer's private-field reflection on
> {{StreamExecutionEnvironment.configuration}} -> per-generation
> {{StreamExecutionEnvironmentAdapter}}; the legacy {{addSource}} call sites
> route through it as well.
> * Dead reflection removed by direct calls: {{MySqlSource.metricGroup}} and
> the {{PreTransformOperator}} {{Class.forName}} probe - both APIs are stable
> on both generations.
> * Legacy {{SinkFunction}} / {{SourceFunction}} call sites (moved to the
> legacy subpackage by 2.x) route through {{StreamSinkAdapter}};
> {{RuntimeContextAdapter}}'s signature narrowed to the minimal common
> interface.
> * 8 call-site files and 7 new/adjusted adapter classes, 17 files in total.
> h2. Non-goals
> No bytecode-scan guard - neither Paimon nor Fluss carries such a test, and
> the adapters are the structural fix. No behavior change (side effect: the
> composer jar becomes byte-identical across generations).
> h2. Verification
> Dual-generation builds + unit tests of the affected modules; the reflection
> sites are gone from the built classes.
> h2. Dependencies
> After the compat-layer split (the adapters live in the common modules).
> ================================================================
> Sub-task S5
> Summary: Produce the per-version dist from a line-parameterized dist module
> ================================================================
> h2. Purpose
> One dist module produces the distribution of whichever Flink line is being
> built: {{flink-cdc-dist-flink-1.20}} / {{flink-cdc-dist-flink-2.2}} and the
> {{flink-cdc-<version>-flink-<line>-bin}} tarball - the Paimon/Fluss artifact
> shape, where the artifactId carries the line and the version string stays
> clean. No per-line module clones, no gating properties.
> h2. Changes
> * New root property {{flink.line}} (default 1.20, {{flink2}} profile -> 2.2);
> the dist artifactId becomes {{flink-cdc-dist-flink-${{{flink.line}}}}} and
> the assembly finalName follows.
> * The Yarn dist-jar lookup derives the Flink line at runtime from the running
> jar's own name ({{flink-cdc-dist-flink-<ver>-*.jar}}, legacy names
> understood, unidentifiable shapes fail loudly) instead of the build-time
> filtered resource: a single build-time value cannot serve two same-generation
> releases, while self-identifying jars always answer for themselves. Side
> effect: the composer jar becomes generation-neutral.
> * The dist additionally depends on the thin module
> {{flink-cdc-flink-${{{flink.line}}}}} (compile), so a future thin-module
> class wins the shade priority over the common module.
> * Release script: two-line invocation + transition-period legacy-named
> artifacts; update_version.sh, Dockerfile ARG, .gitignore
> ({{release-artifacts/}}), pipeline-e2e dist selection via a
> {{flink.dist.artifactId}} property.
> * Preserved as-is: the dist keeps its generation-specific guava dependency
> (module-local, as today).
> h2. Verification
> Dual-generation builds; jar-level comparison of the dist fat jar against the
> pre-refactor artifact of the matching line (class content identical, GAV
> metadata aside); Yarn lookup unit tests (exact / generation mismatch /
> ambiguity / legacy fallback); e2e via CI.
> h2. Dependencies
> After the compat-layer split (thin modules exist). Independent of the
> reflection sub-task.
> ================================================================
> Sub-task S6
> Summary: Produce per-version connector fat jars from line-parameterized
> modules
> ================================================================
> h2. Purpose
> The 9 SQL source connector fat jars and the 4 pipeline connectors whose
> shaded external dependency lines fork across generations (kafka, paimon,
> elasticsearch, iceberg) become single line-parameterized modules:
> {{flink-sql-connector-<X>-cdc${{{source.fatjar.suffix}}}}} /
> {{flink-cdc-pipeline-connector-<X>${{{pipeline.fatjar.suffix}}}}}. One
> module, one shade configuration, no per-line clones.
> The other 11 pipeline connector fat jars keep a single GAV: a jar-level scan
> of all 15 pipeline connectors proved their content cross-generation
> equivalent (annotation / metadata-only differences, or byte-identical).
> Repository invariant: no artifact whose content varies across generations
> while its GAV carries no generation identity.
> h2. Changes
> * Root properties {{source.fatjar.suffix}} / {{pipeline.fatjar.suffix}} =
> {{-flink-${{{flink.line}}}}}; 13 connector poms parameterize their artifactId.
> * The fat-jar modules depend on the thin module
> {{flink-cdc-flink-${{{flink.line}}}}} (compile).
> * license_check.rb jar-name matching; source-e2e fat jar selection from the
> line property; a new CI job running the source e2e on the 2.2 line.
> * Release script finalized: the flink1 line deploys everything exactly once;
> the flink2 line installs fully, then deploys a {{-pl}}-restricted per-version
> list (no {{-am}} - a second deploy of shared GAVs would be rejected by Nexus
> staging, protectively so).
> * 2.x-line jdbc coordinates adapted ({{flink-connector-jdbc-core}} + the
> split dialect jar).
> h2. Verification
> Dual-generation builds; jar-level comparison of every per-version fat jar
> against the pre-refactor artifact of its line (the 4 pipeline fat jars each
> drop exactly the placeholder class the old per-line shells contributed; the
> SQL and dist fat jars are byte-identical); e2e on both lines via CI.
> h2. Dependencies
> After the dist sub-task ({{flink.line}}).
> ================================================================
> Sub-task S7
> Summary: Refresh the docs for the per-version artifact naming
> ================================================================
> h2. Purpose
> Align the documentation with the artifact coordinates introduced by the dist
> and connector sub-tasks, in both languages.
> h2. Changes
> * README artifact-naming notes; the download tables (GAV column) of the
> source and pipeline connector overview pages; the DataStream packaging
> guidance pom examples; the FAQ artifact-name examples.
> * A short "which jar do I pick" note per version line.
> * EN and zh updated together (~29 pages).
> h2. Non-goals
> The tutorial pages (mysql-to-kafka, migrate-paimon-cdc-action, ...) need a
> full-page refresh of their download tables and are tracked separately.
> h2. Dependencies
> After the dist and connector sub-tasks (the names being documented must
> exist).
> ================================================================
> Optional follow-up (outside the series)
> Summary: Skip the starrocks and hudi fat jars under the flink2 build
> ================================================================
> h2. Purpose
> The starrocks and hudi shaded external SDKs are only published for the Flink
> 1.x line; under {{-Pflink2}} the fat jars are assembled anyway from the
> 1.20-line SDK - artifacts labeled flink2 that cannot work on Flink 2.x.
> h2. Changes
> {{connector.generation.skip=true}} in the root {{flink2}} profile;
> {{<skip>${{{connector.generation.skip}}}</skip>}} on the shade executions of
> the two modules; the CI flink2 matrix drops starrocks; a README note. The
> modules still compile and run their tests on the flink2 line - only the fat
> jar is skipped.
> h2. Note
> The only behavioral change in the whole effort; submitted separately and only
> with maintainer sign-off.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)