Status

Current state: Released

Discussion thread: https://lists.apache.org/thread/hod6bg421bzwhbfv60lwsck7r81dvo59

JIRA: FLINK-35378 - Getting issue details... STATUS

Released: 1.20

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

Motivation

This FLIP proposes to promote the Unified Sink API V2 from PublicEvolving to Public and to mark the SinkFunction as Deprecated. Since its introduction in Flink 1.12, the Unified Sink API has undergone extensive development and testing, evidenced by its evolution across multiple FLIPs and its adoption in major connectors like Kafka, FileSystem, and AWS since Flink 1.14 and beyond. Over more then four release cycles, the API has demonstrated stability and robustness, aligning with the criteria set forth in FLIP-197 for API stability graduation. This promotion is expected to encourage wider adoption by signaling the API’s maturity and reliability to the user base. This step is essential for standardizing Flink’s API landscape, much like the transition from SourceFunction to Source API, thereby enhancing the framework's overall functionality and maintainability.

The following table shows the relevant FLIPs that lead to the SinkV2 API as it has been released with Flink 1.19

FLIPNoteAPI AnnotationReleased with
FLIP-143: Unified Sink APIIntroduction of new Unified Sink APIExperimental Flink 1.12
FLIP-177: Extend Sink APIExtends Unified Sink APIExperimental Flink 1.14
FLIP-171: Async SinkIntroduces generic Async Sink API, based on the Unified Sink APIPublicEvolvingFlink 1.15
FLIP-191: Extend unified Sink interface to support small file compactionExtends Unified Sink API with introduction of SinkV2

Sink: Experimental to PublicEvolving  and Deprecated 

SinkV2: PublicEvolving 

Flink 1.15
FLIP-371: Provide initialization context for Committer creation in TwoPhaseCommittingSink

Added ability to emit metrics from the committer

SinkV2: PublicEvolving 

Flink 1.19
FLIP-372: Enhance and synchronize Sink API to match the Source API

Changed the Sink V2 API so that it uses mixin interfaces to enhance the extendibility of the API, similar to the Source API.

SinkV2: PublicEvolving 

Flink 1.19

The following table shows the state of migration to SinkV2 for ASF supported and released connectors:

StatusConnectorUsed Sink/SinkV2 since
FileSystem

Flink 1.12 FLINK-19758 - Getting issue details... STATUS

Kafka / Upsert-Kafka

Flink 1.14 FLINK-22902 - Getting issue details... STATUS

Cassandra

FLINK-26821 - Getting issue details... STATUS

DynamoDB

AWS Connector v3.0 (via ASync API) FLINK-24229 - Getting issue details... STATUS

Elasticsearch

Flink 1.15 FLINK-24323 - Getting issue details... STATUS

Firehose

Flink 1.15 (via ASync API) FLINK-24228 - Getting issue details... STATUS

Kinesis

Flink 1.15 (via ASync API) FLINK-24227 - Getting issue details... STATUS

MongoDB

MongoDB v1.0 (via ASync API) FLINK-6573 - Getting issue details... STATUS

Opensearch

Opensearch v1.0 (via ASync API) FLINK-25756 - Getting issue details... STATUS

RabbitMQ

FLINK-21373 - Getting issue details... STATUS

Google Cloud PubSub

FLINK-24296 - Getting issue details... STATUS / FLINK-24298 - Getting issue details... STATUS

Pulsar

Flink 1.15 FLINK-26022 - Getting issue details... STATUS

JDBC

JDBC v3.2.0 FLINK-25421 - Getting issue details... STATUS

HBase

FLINK-35280 - Getting issue details... STATUS

This topic has also been previously discussed on the Dev mailing list in https://lists.apache.org/thread/q62nj89rrz0t5xtggy5n65on95f2rmmx

Public Interfaces

  • The following interfaces will be marked as @Deprecated 
    • org.apache.flink.streaming.api.functions.sink#SinkFunction
    • org.apache.flink.streaming.api.functions.sink#SocketClientSink
    • org.apache.flink.streaming.api.functions.sink#TwoPhaseCommitSinkFunction
  • The following interfaces will be marked as @Public 
    • org.apache.flink.api.connector.sink2#Committer
    • org.apache.flink.api.connector.sink2#CommitterInitContext
    • org.apache.flink.api.connector.sink2#CommittingSinkWriter
    • org.apache.flink.api.connector.sink2#Sink
    • org.apache.flink.api.connector.sink2#SinkWriter
    • org.apache.flink.api.connector.sink2#StatefulSinkWriter
    • org.apache.flink.api.connector.sink2#SupportsCommitter
    • org.apache.flink.api.connector.sink2#SupportsWriterState
    • org.apache.flink.api.connector.sink2#WriterInitContext

Proposed Changes

Properly annotate the above interfaces with the designated annotation. 

Compatibility, Deprecation, and Migration Plan

  • We need to include in the next release notes that these interfaces are deprecated / designated to by annotated as Public
  • Change the existing org.apache.flink.streaming.api.functions.sink#DiscardingSink, org.apache.flink.streaming.api.functions.sink#PrintSink and org.apache.flink.streaming.api.functions.sink#PrintSinkFunction to use the new interfaces

Test Plan

Existing tests

Rejected Alternatives

N/A