Skip to content

[ISSUE #155] refactor: migrate to the new Source/Sink API only - #157

Merged
lizhimins merged 2 commits into
apache:mainfrom
lizhimins:issue-155-new-api-migration
Nov 2, 2026
Merged

lizhimins merged 2 commits into
apache:mainfrom
lizhimins:issue-155-new-api-migration

Conversation

@lizhimins

Copy link
Copy Markdown
Member

What

Migrate the connector to the new Source/Sink API only, staying on Flink 1.20.3 / Java 11, following the maintenance model of apache/flink-connector-kafka (new API only, zero legacy, version differences isolated in branches). Tracking issue: #155.

  • Delete the legacy source/sink paths and their tests; the FLIP-27 Source and the sink2 Sink + SupportsCommitter become the only runtime paths. The SQL factory keeps accepting the existing DDL options but resolves them to the new implementations.
  • TableSchema / SchemaValidator -> ResolvedSchema; Configuration.getXxx(ConfigOption) / setXxx -> get / set.
  • Sink.InitContext and TypeInformation.createSerializer(ExecutionConfig) are still abstract in 1.20; implement the deprecated overloads as delegations. The 1.20 runtime calls the WriterInitContext / SerializerConfig overloads, so the main code path is already the 2.x one.

Why

Flink 2.x removed SourceFunction, SinkFunction, TwoPhaseCommittingSink, TableSchema and the ConfigOption-typed Configuration accessors. With legacy and new implementations shipped side by side, the connector cannot compile against 2.x and every fix lands twice (e.g. #141 / #148). Kafka and Pulsar both keep every branch on the new API only; this PR puts main on that shared basis first.

Semantics

Unchanged. At-least-once / exactly-once guarantees, offset management from Flink state, checkpoint-aligned transaction commits and the #154 async-send bounding / seek-retry behavior all stay as they are — this is an API migration, not a behavior change. The proxy-fronted EXACTLY_ONCE limitation documented in #152 still applies.

Verification

  • mvn clean install green on JDK 17 targeting Java 11: remoting 146 / grpc 80 unit tests, checkstyle / spotless zero violations, both remoting and grpc SQL fat-jars produced.
  • The 2.x variant of this codebase was verified against Flink 2.2.1 with the same tests passing; it differs from this PR by a single small commit (pom versions, dropping the deprecated-overload bridges above, one test package path, CI matrix).

Follow-up (proposed in #155)

This commit is the branch point for the 1.x maintenance line: after it merges, cut the maintenance branch here, then a follow-up single-commit PR switches main to Flink 2.2.1 / Java 17 (flip flink.version, drop the 1.20-only bridges, CI matrix to JDK 17). Fixes then cherry-pick between the two lines, as Kafka does.

Flink 2.x removed SourceFunction, SinkFunction, TwoPhaseCommittingSink,
TableSchema and the ConfigOption-typed Configuration accessors. The
connector still ships the legacy implementations next to the FLIP-27 /
sink2 ones, so it cannot compile against 2.x and every fix lands twice.

Following apache/flink-connector-kafka (new API only, zero legacy,
version differences isolated in branches), migrate the shared codebase
to the new API while staying on Flink 1.20.3 / Java 11:

- Delete the legacy source/sink paths and their tests; the FLIP-27
  Source and the sink2 Sink + SupportsCommitter become the only runtime
  paths. The SQL factory keeps accepting the existing DDL options but
  resolves them to the new implementations.
- TableSchema / SchemaValidator -> ResolvedSchema; Configuration
  getXxx(ConfigOption) / setXxx -> get / set.
- Sink.InitContext and TypeInformation.createSerializer(ExecutionConfig)
  are still abstract in 1.20; implement the deprecated overloads as
  delegations. The 1.20 runtime calls the WriterInitContext /
  SerializerConfig overloads, so the main code path is already the 2.x
  one.
- The async-send bounding and seek-retry behavior of apache#154 is preserved.

Semantics are unchanged: at-least-once / exactly-once guarantees, offset
management from Flink state, checkpoint-aligned transaction commits and
the apache#154 permit accounting all stay as they are; this is an API
migration, not a behavior change.

Verified: mvn clean install green on JDK 17 targeting Java 11 (remoting
146 / grpc 80 unit tests, checkstyle and spotless clean), both SQL
fat-jars produced.

This is the branch point for the 1.x maintenance line (apache#155): a follow-up
commit switches main to Flink 2.2.1 / Java 17 by flipping flink.version
and dropping the deprecated-overload bridges above.
The JDK 17 leg of the build silently skips spotless ("Spotless check
skipped"), so the four files reformatted here only surfaced on the JDK 11
leg, which is the one that actually runs the formatter. Wrap them to the
100-column google-java-format output; no behavioural change.
@lizhimins
lizhimins merged commit 0b3ae9d into apache:main Nov 2, 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