seatunnel icon indicating copy to clipboard operation
seatunnel copied to clipboard

[Feature][Flink] Add flink version 1.20.1 support

Open yzeng1618 opened this issue 5 months ago • 20 comments

https://github.com/apache/seatunnel/issues/9513

Purpose of this pull request

This pull request fixes the Flink 1.20 compatibility issue in the SeaTunnel Flink translation layer. The current implementation uses reflection to access internal StreamingRuntimeContext from SourceReaderContext, which is fragile and may break with Flink version updates.

Does this PR introduce any user-facing change?

No. This is an internal implementation fix that maintains the same public API behavior. Users will continue to use the same SeaTunnel connector APIs without any changes. The metrics functionality remains identical from the user perspective.

How was this patch tested?

Manual Testing: Built SeaTunnel with Flink 1.20 dependencies Ran sample connector jobs to verify metrics collection Confirmed no reflection-related errors in logs Validated metrics appear correctly in Flink Web UI

Check list

  • [ ] If any new Jar binary package adding in your PR, please add License Notice according New License Guide
  • [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs
  • [ ] If you are contributing the connector code, please check that the following files are updated:
    1. Update plugin-mapping.properties and add new connector information in it
    2. Update the pom file of seatunnel-dist
    3. Add ci label in label-scope-conf
    4. Add e2e testcase in seatunnel-e2e
    5. Update connector plugin_config

yzeng1618 avatar Jul 15 '25 11:07 yzeng1618

cc @TyrantLucifer

Hisoka-X avatar Jul 15 '25 11:07 Hisoka-X

Good pr

TyrantLucifer avatar Jul 15 '25 11:07 TyrantLucifer

We need new flink 1.20.1 test container to verify it. https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/flink

The code has now been simplified and the Flink20Container has been added.

yzeng1618 avatar Aug 03 '25 13:08 yzeng1618

https://hub.docker.com/repository/docker/tyrantlucifer/flink/tags/1.20.2-scala_2.12_hadoop27/sha256-2a3f548cd690dd3718fbcd73208c9de7d28bbbd9385df3581ccf347128b390d0

I have pushed test docker image, tag is tyrantlucifer/flink:1.20.2-scala_2.12_hadoop27

TyrantLucifer avatar Aug 04 '25 05:08 TyrantLucifer

https://hub.docker.com/repository/docker/tyrantlucifer/flink/tags/1.20.2-scala_2.12_hadoop27/sha256-2a3f548cd690dd3718fbcd73208c9de7d28bbbd9385df3581ccf347128b390d0

I have pushed test docker image, tag is tyrantlucifer/flink:1.20.2-scala_2.12_hadoop27 We've currently found that when using this Docker image, there seem to be some image-related issues during the execution of the CI process. Could you please check it out?

yzeng1618 avatar Aug 06 '25 08:08 yzeng1618

We need new flink 1.20.1 test container to verify it. https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/flink

The test container for Flink 1.20 has been added.

yzeng1618 avatar Sep 03 '25 01:09 yzeng1618

We need new flink 1.20.1 test container to verify it. https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-e2e-common/src/test/java/org/apache/seatunnel/e2e/common/container/flink

It has been added.

yzeng1618 avatar Sep 23 '25 01:09 yzeng1618

LGTM

6243a6bccb385914b46c9ab4d9e9eabe Because this commit is merged into dev, we need to resolve conflicts and then re-run the CI process. Please approve it again.

yzeng1618 avatar Sep 26 '25 12:09 yzeng1618

waiting test case passes.

Hisoka-X avatar Oct 01 '25 12:10 Hisoka-X

@yzeng1618 CI failed. Please check

Carl-Zhou-CN avatar Oct 13 '25 10:10 Carl-Zhou-CN

waiting test case passes.

@yzeng1618 CI failed. Please check

Currently, it seems that there is an issue with the CI (Continuous Integration) process of the dev (development) environment itself.

yzeng1618 avatar Oct 20 '25 10:10 yzeng1618

image @Hisoka-X @zhangshenghang It seems there's a problem with the mirror image. Do you have any updated information?

Carl-Zhou-CN avatar Oct 21 '25 07:10 Carl-Zhou-CN

image @Hisoka-X @zhangshenghang It seems there's a problem with the mirror image. Do you have any updated information?

It should be working normally now, and other users haven't reported this issue.

zhangshenghang avatar Oct 23 '25 13:10 zhangshenghang

Please merge dev. it fix the timeout issue.

zhangshenghang avatar Oct 23 '25 13:10 zhangshenghang

Please merge dev. it fix the timeout issue.

Have merged

yzeng1618 avatar Oct 24 '25 02:10 yzeng1618

Please pull the latest changes and try again.

dybyte avatar Oct 26 '25 13:10 dybyte

@Hisoka-X @TyrantLucifer @Carl-Zhou-CN @zhangshenghang After adapting the new code and fixing the CI (Continuous Integration) process, the modifications have now been completed. Could you please help review this

yzeng1618 avatar Nov 05 '25 01:11 yzeng1618

@Hisoka-X @TyrantLucifer Do you still have any questions about the previous issue?

zhangshenghang avatar Nov 17 '25 01:11 zhangshenghang

issue?

Yes,it also has some problems,please wait a minute

TyrantLucifer avatar Nov 17 '25 01:11 TyrantLucifer

issue?

Yes,it also has some problems,please wait a minute

Please take some time to elaborate on the specific issues in detail @TyrantLucifer

yzeng1618 avatar Nov 17 '25 06:11 yzeng1618

8e64f74d721a21442b01547ff231e20f

I try to implement metrics use origin logic, it looks worked.

https://github.com/TyrantLucifer/incubator-seatunnel/tree/BDPL-support1.20.1-test-metrics

cc @CloverDew

TyrantLucifer avatar Dec 14 '25 10:12 TyrantLucifer

8e64f74d721a21442b01547ff231e20f I try to implement metrics use origin logic, it looks worked.

https://github.com/TyrantLucifer/incubator-seatunnel/tree/BDPL-support1.20.1-test-metrics

cc @CloverDew

meter also worked

image

TyrantLucifer avatar Dec 14 '25 10:12 TyrantLucifer

8e64f74d721a21442b01547ff231e20f I try to implement metrics use origin logic, it looks worked. https://github.com/TyrantLucifer/incubator-seatunnel/tree/BDPL-support1.20.1-test-metrics cc @CloverDew

meter also worked

image

Thanks a lot for your review and guidance. @TyrantLucifer My original counter implementation in the test branch was mainly to get things working, but it has some drawbacks: it maintains two states (metrics.Counter + accumulator), relies on special handling for a few “key” metrics, and diverges from the Flink 1.13 implementation. The current approach using runtimeContext.getLongCounter(name) and the shared FlinkCounter is cleaner and more consistent across Flink versions, so I’m happy to follow this design.

yzeng1618 avatar Dec 14 '25 12:12 yzeng1618

LGTM, waiting CICD, thank for your contribution ! @yzeng1618

TyrantLucifer avatar Dec 14 '25 15:12 TyrantLucifer

LGTM, waiting CICD, thank for your contribution ! @yzeng1618

Thanks a lot for your guidance

yzeng1618 avatar Dec 15 '25 01:12 yzeng1618