Skip to content

[FLINK-39429][cdc-base] Avoid shaded Guava in incremental source fetchers#4462

Open
qiuyanjun888 wants to merge 1 commit into
apache:masterfrom
qiuyanjun888:fix/flink-39429-cdc-bugfix
Open

[FLINK-39429][cdc-base] Avoid shaded Guava in incremental source fetchers#4462
qiuyanjun888 wants to merge 1 commit into
apache:masterfrom
qiuyanjun888:fix/flink-39429-cdc-bugfix

Conversation

@qiuyanjun888

Copy link
Copy Markdown

Summary

  • Remove production references to Flink's shaded Guava 31 classes from flink-cdc-base incremental source fetcher paths.
  • Replace ThreadFactoryBuilder usage with a small JDK-only daemon thread factory.
  • Replace Lists.partition usage with a local JDK-only partition helper.
  • Add a regression test that blocks shaded Guava 31 classes and scans compiled production classes for shaded-Guava references.

Root Cause

FLINK-39429 reports NoClassDefFoundError for org/apache/flink/shaded/guava31/... when running CDC with Flink 2.2. The flink-cdc-base production classes referenced Flink's shaded Guava 31 package directly, but that package is not available in the reported runtime environment.

Fix

  • Use JDK-only ThreadFactory implementations in:
    • IncrementalSourceStreamFetcher
    • IncrementalSourceScanFetcher
    • SnapshotSplitAssigner
  • Use a JDK-only partition(...) helper in IncrementalSourceEnumerator.
  • Add IncrementalSourceFetcherDependencyTest to prevent shaded Guava 31 references from returning in flink-cdc-base production classes.

Validation

  • mvn -pl flink-cdc-connect/flink-cdc-source-connectors/flink-cdc-base -am -Pflink2 -Dtest=IncrementalSourceFetcherDependencyTest -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false -DskipITs -Dcheckstyle.skip -Drat.skip=true -Dspotless.check.skip=true -Dmdep.skip=true test
  • mvn -pl flink-cdc-connect/flink-cdc-source-connectors/flink-cdc-base -am -Pflink2 -Dtest='!SplitKeyUtilsTest,!FinishedSnapshotSplitInfoTest' -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false -DskipITs -Dcheckstyle.skip -Drat.skip=true -Dspotless.check.skip=true -Dmdep.skip=true test
  • mvn -pl flink-cdc-connect/flink-cdc-source-connectors/flink-cdc-base -am -Pflink2 -DskipTests -Drat.skip=true -Dmdep.skip=true verify

Note: the broader module test command excludes two known Java 17 Mockito blocker tests (SplitKeyUtilsTest, FinishedSnapshotSplitInfoTest) that are unrelated to this change.

Jira

https://issues.apache.org/jira/browse/FLINK-39429

Reviewers

cc @leonardBang @haruki-830 — you recently reviewed/authored changes touching this area.

AI Assistance Disclosure

This PR was prepared with AI-assisted tooling and manually validated with the commands above.

@github-actions github-actions Bot added the base label Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant