Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Status

Current state: Under DiscussionReleased

Discussion thread:  here (<- link to https://mail-archiveslists.apache.org/mod_mbox/flink-dev/)

JIRAhere (<- link to https://issues.apache.org/jira/browse/FLINK-XXXX)

thread/hod6bg421bzwhbfv60lwsck7r81dvo59

JIRA:

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-35378

Released: 1.20Released: <Flink Version>

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

...

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, CassandraFileSystem, and Elasticsearch 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

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-19758

Kafka / Upsert-Kafka

Flink 1.14

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-22902

Cassandra

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-26821

DynamoDB

AWS Connector v3.0 (via ASync API)

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-24229

Elasticsearch

Flink 1.15

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-24323

Firehose

Flink 1.15 (via ASync API)

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-24228

Kinesis

Flink 1.15 (via ASync API)

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-24227

MongoDB

MongoDB v1.0 (via ASync API)

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-6573

Opensearch

Opensearch v1.0 (via ASync API)

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-25756

RabbitMQ

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-21373

Google Cloud PubSub

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-24296
/
Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-24298

Pulsar

Flink 1.15

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-26022

JDBC

JDBC v3.2.0

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-25421

HBase

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyFLINK-35280

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. 

...

A public interface is any change to the following:

  • DataStream and DataSet API, including classes related to that, such as StreamExecutionEnvironment
  • Classes marked with the @Public annotation
  • On-disk binary formats, such as checkpoints/savepoints
  • User-facing scripts/command-line tools, i.e. bin/flink, Yarn scripts, Mesos scripts
  • Configuration settings
  • Exposed monitoring information

Proposed Changes

Describe the new thing you want to do in appropriate detail. This may be fairly extensive and have large subsections of its own. Or it may be a few sentences. Use judgement based on the scope of the change.

Compatibility, Deprecation, and Migration Plan

  • What impact (if any) will there be on existing users? 
  • If we are changing behavior how will we phase out the older behavior? 
  • If we need special migration tools, describe them here.
  • When will we remove the existing behavior?

Test Plan

Describe in few sentences how the FLIP will be tested. We are mostly interested in system tests (since unit-tests are specific to implementation details). How will we know that the implementation works as expected? How will we know nothing broke?

Rejected Alternatives

  • 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/AIf there are alternative ways of accomplishing the same thing, what were they? The purpose of this section is to motivate why the design is the way it is and not some other way.