Skip to content

[ISSUE #155] refactor: target Flink 2.2.1 on main (Java 17) - #158

Merged
lizhimins merged 1 commit into
apache:mainfrom
lizhimins:issue-155-flink-2.2.1
Nov 3, 2026
Merged

lizhimins merged 1 commit into
apache:mainfrom
lizhimins:issue-155-flink-2.2.1

Conversation

@lizhimins

Copy link
Copy Markdown
Member

Motivation

Step 3 of #155. #157 made the codebase new-API only, so supporting Flink 2.x is now just the version switch. This makes main the 2.x line, the same shape apache/flink-connector-kafka uses (2.x on main, 1.x on a maintenance branch).

The 1.x line already exists: branch v3.0 points at the #157 merge commit 0b3ae9d (Flink 1.20.3 / Java 11). The diff between the two lines is exactly this commit, so a fix cherry-picks both ways without adaptation in the shared code.

Changes

  • flink.version 1.20.3 -> 2.2.1, target.java.version / compiler release 11 -> 17.
  • Drop the deprecated-overload bridges that only 1.20 needs (Sink.InitContext + InitContextAdapter in RocketMQSink / RocketMQGrpcSink, createSerializer(ExecutionConfig) in AckableMessageTypeInfo): 2.x declares the WriterInitContext / SerializerConfig overloads abstract, and 1.20 calls those overloads at runtime too, so the bridges only served callers still passing the old context types.
  • RocketMQGrpcITCase collects with sink.legacy.RichSinkFunction, the 2.x package (1.20 has no sink.legacy subpackage).
  • CI: the build matrix drops JDK 11 (Flink 2.x requires Java 17 at compile time). But spotless 2.27.1 silently skips its Java formatter on JDK 16+ (the log line is Spotless check skipped), so keeping spotless:check inside the JDK 17 job would have dropped the only style gate that actually runs. It moves to a dedicated JDK 11 job — formatting does not compile against Flink, so it can stay on 11.

Verification

  • mvn -B clean package green on JDK 17: 146 remoting (4 skipped) + 80 grpc unit tests, 0 failures; both SQL fat-jars produced.
  • mvn -B spotless:check green on JDK 11 (this is the leg that actually formats).
  • End to end on a Flink 2.2.1 K8s Application-mode cluster (official flink:2.2.1-scala_2.12-java17 base, flink-oss-fs-hadoop-2.2.1, checkpoint/savepoint to OSS): 1000 x 4KB passthrough reconciles 1001/1001 against broker physical offsets with 0 missing / 0 unexpected / 0 duplicate, on both a direct nameserver deployment and a proxy deployment; startup-offset (latest / timestamp / specific), tag and SQL92 filter cases match the expected id sets exactly; transactional sink commits 101/101 on the direct deployment at both 10s and 45s checkpoint intervals; TM/JM deletion, broker kill and a 60s nameserver outage all recover with 0 missing (the job stays RUNNING with a single JobID, no split re-assignment).

Note for the next release

Both lines currently carry project version 3.0.0, so the two artifacts would collide on the same GAV with different content. Following the Kafka convention, release artifacts should carry the Flink version as a second segment (3.0.0-1.20 from v3.0, 3.0.0-2.2 from main).

Now that the codebase is new-API only, supporting Flink 2.x is just the
version switch:

- flink.version 1.20.3 -> 2.2.1, Java 17 bytecode.
- The CI build matrix drops JDK 11 (Flink 2.x requires Java 17 at compile
  time), but spotless 2.27.1 silently skips its Java formatter on JDK 16+
  ("Spotless check skipped"), so the style check moves to a dedicated
  JDK 11 job. Leaving it inside the build job would have dropped the only
  style gate that actually runs.
- Drop the deprecated-overload bridges that only 1.20 needs
  (Sink.InitContext, createSerializer(ExecutionConfig)); 2.x declares
  the WriterInitContext / SerializerConfig overloads abstract.
- The grpc ITCase collects with sink.legacy.RichSinkFunction, the 2.x
  package; 1.20 has no sink.legacy subpackage.

The 1.x maintenance branch (v3.0) keeps 1.20.3 and the bridges; the diff
between the two lines is exactly this commit, so fixes cherry-pick both
ways without adaptation in the shared code.

Verified: mvn clean package green on JDK 17 (remoting 146 / grpc 80 unit
tests), spotless:check green on JDK 11, both SQL fat-jars produced.
@lizhimins
lizhimins merged commit 7fe6ad8 into apache:main Nov 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant