Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-35281][hotfix][cdc-common] FlinkEnvironmentUtils#addJar add each jar only once #3301

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

loserwang1024
Copy link
Contributor

@loserwang1024 loserwang1024 commented May 8, 2024

Current org.apache.flink.cdc.composer.flink.FlinkEnvironmentUtils#addJar will be invoked for each source and sink.

public static void addJar(StreamExecutionEnvironment env, URL jarUrl) {
    try {
        Class<StreamExecutionEnvironment> envClass = StreamExecutionEnvironment.class;
        Field field = envClass.getDeclaredField("configuration");
        field.setAccessible(true);
        Configuration configuration = ((Configuration) field.get(env));
        List<String> jars =
                configuration.getOptional(PipelineOptions.JARS).orElse(new ArrayList<>());
        jars.add(jarUrl.toString());
        configuration.set(PipelineOptions.JARS, jars);
    } catch (Exception e) {
        throw new RuntimeException("Failed to add JAR to Flink execution environment", e);
    } 

if multiple source or sink share same jar, the par path will be added repeatly. For example, mysql to mysql later.

@loserwang1024
Copy link
Contributor Author

@yuxiqian , @PatrickRen , CC

Copy link
Contributor

@yuxiqian yuxiqian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for @loserwang1024's contribution, I just left some minor comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants