Versions Compared

Key

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

Status

Current state:   [One of "Under Discussion", "Accepted", "Rejected"]

Discussion thread:  here (<- link to https://mail-archiveslists.apache.org/mod_mbox/flink-dev/)
JIRA: here (<- link to https://issues.apache.org/jira/browse/FLINK-XXXX)thread/cv4x3372g5txw1j20r5l1vwlqrvjoqq5

JIRA:

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

Released: <Flink Version>

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

Motivation

Currently, the FLINK RuntimeContext plays a crucial role in connecting user functions with the underlying runtime details. It provides users with essential runtime information, such as taskName, subTaskIndex, and attemptNumber, enabling them to access these details during job execution.

...

To address this problem, we propose deprecating the RuntimeContext#getExecutionConfig in the FLINK RuntimeContext. In the upcoming FLINK-2.0 version, we plan to completely remove the RuntimeContext#getExecutionConfig method. And we will introduce alternative getter methods that allow users to access specific information without exposing unnecessary runtime details.

Public Interfaces

Adding @Deprecated to RuntimeContext#getExecutionConfig()

Adding the following three getter methods with @PublicEvolving in RuntimeContext:

Code Block
	/**
     * Create a serializer for a given type.
     *
     * @param typeInformation the type information of the object to be serialized
     * @return the serializer for the given type
     */
    @PublicEvolving
    <T> TypeSerializer<T> createSerializer(TypeInformation<T> typeInformation);

    /**
     * Get global job parameters.
     *
     * @return the global job parameters
     */
    @PublicEvolving
    Map<String, String> getGlobalJobParameters();

    /**
     * Whehter enable object reuse.
     *
     * @return true if object reuse is enabled, false otherwise
     */
    @PublicEvolving
    boolean isObjectReuseEnabled();

Proposed Changes

We propose deprecating the RuntimeContext#getExecutionConfig method and transitioning all its usages to the following new getter method:

  1. Migrate the usage of TypeInformation#createSerializer(RuntimeContext#getExecutionConfig) to RuntimeContext#createTypeSerializer(TypeInformation).

  2. Migrate the usage of  RuntimeContext#getExecutionConfig.getGlobalJobParameters to RuntimeContext#getGlobalJobParameters.

  3. Migrate the usage of  RuntimeContext#getExecutionConfig.isObjectReuseEnabled to RuntimeContext#isObjectReuseEnabled.

Compatibility, Deprecation, and Migration Plan

The RuntimeContext#getExecutionConfig method is planned to be deprecated in Flink-1.19 and eventually removed in Flink-2.0.

Test Plan

N.A.

Rejected Alternatives

Do not add createKryoSerializer and getAutoWatermarkInterval to RuntimeContext for Kafka and Kinesis connector:

In the versions of the Kafka and Kinesis connectors that use the legacy Source, RuntimeContext#getExecutionConfig is used to create KryoSerializer and retrieve the interval for automatic watermark emission. However, FLINK-2.0 requires all connectors to migrate to the new Source API (FLIP-27). As a result, there is no need to add the methods createKryoSerializer and getAutoWatermarkInterval to the RuntimeContext.