Versions Compared

Key

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

...

The goal of this FLIP is to add additional fields to Sink#InitContext to expose ExecutionConfig , (or at least the ExecutionConfig#isObjectReuseEnabled) and JobID.

This is necessary to migrate the current JdbcSink to the SinkV2 (FLIP-239 -> FLINK-25421) more specifically in order to be able to reuse the current code:

  • the JdbcOutputFormat which today uses RuntimeContext to get the ExecutionConfig#isObjectReuseEnabled. 
  • the SemanticXidGenerator (for Xa-Sink) needs JobID to create the Xid.


This would be necessary to another connectors as well, for example KafkaTableSink uses isObjectReuseEnabled too.

Public Interfaces

  • We want to extend the Sink#InitContext to provide the ExecutionConfig and JobID.

Proposed Changes

We propose to expose the ExecutionConfig, so that all configs on this will be available, but we could only expose the isObjectReuse if we want to expose only the required configuration.

Code Block
languagejava
titleInitContext
@PublicEvolving
public interface Sink<InputT> extends Serializable {
    ... current methods
 
    @PublicEvolving
    public interface InitContext {
        ... current methods

		        /**	           
    	     * Returns the {@link org.apache.flink.api.common.ExecutionConfig} for the currently executing job.
    	 * job.
    	     */
        ExecutionConfig getExecutionConfig();

        /**
         * The ID of the current job. Note that Job ID can change in particular upon manual restart.
         * The returned ID should NOT be used for any job management tasks.
         */
        ExecutionConfigJobID getExecutionConfiggetJobId();
      
	}
}  


Compatibility, Deprecation, and Migration Plan

...