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-34613][cdc] Support recover from a specific savepoint file #2959

Merged
merged 2 commits into from
Apr 9, 2024

Conversation

lvyanquan
Copy link
Contributor

This closes #2940.
Use fromSavepoint to be consistent with Flink cli. Some codes are inspired from CliFrontendParser.

@github-actions github-actions bot added docs Improvements or additions to documentation cli labels Jan 3, 2024
@lvyanquan
Copy link
Contributor Author

@PatrickRen PTAL.

@lvyanquan lvyanquan force-pushed the savepoint branch 2 times, most recently from 1ba122d to 8f5ecac Compare January 29, 2024 12:24
@Jazzylol
Copy link

@lvyanquan 您好,我使用您的PR打了包,结果报错,错误如下 Exception in thread "main" com.ververica.cdc.shaded.com.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: --fromSavepoint
at com.ververica.cdc.shaded.com.apache.commons.cli.DefaultParser.handleUnknownToken(DefaultParser.java:561)
at com.ververica.cdc.shaded.com.apache.commons.cli.DefaultParser.handleLongOptionWithoutEqual(DefaultParser.java:383)
at com.ververica.cdc.shaded.com.apache.commons.cli.DefaultParser.handleLongOption(DefaultParser.java:334)
at com.ververica.cdc.shaded.com.apache.commons.cli.DefaultParser.handleToken(DefaultParser.java:540)
at com.ververica.cdc.shaded.com.apache.commons.cli.DefaultParser.parse(DefaultParser.java:712)
at com.ververica.cdc.shaded.com.apache.commons.cli.DefaultParser.parse(DefaultParser.java:679)
at com.ververica.cdc.shaded.com.apache.commons.cli.DefaultParser.parse(DefaultParser.java:660)
at com.ververica.cdc.cli.CliFrontend.main(CliFrontend.java:50)

执行的命令 bash /opt/flink-cdc-3.0.0/bin/flink-cdc.sh /opt/flink-cdc-3.0.0/conf/mysql-to-starrocks.yaml --fromSavepoint file:/opt/flink-storage/savepoint/savepoint-f414a3-f2540c5684d0

请问是有什么需要注意的地方吗?

@lvyanquan
Copy link
Contributor Author

@Jazzylol Have you updated lib/flink-cdc-dist-3.0-SNAPSHOT.jar? I have tested again and run correctly.

Copy link
Contributor

@leonardBang leonardBang left a comment

Choose a reason for hiding this comment

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

Thanks @lvyanquan for the contribution, I left some comments

.build();

public static final Option SAVEPOINT_RESTORE_MODE =
Option.builder("rm")
Copy link
Contributor

Choose a reason for hiding this comment

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

rm is a dangerous abbreviation in CS which usually means remove, please avoid use this abbreviation


public static final Option SAVEPOINT_RESTORE_MODE =
Option.builder("rm")
.longOpt("restoreMode")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
.longOpt("restoreMode")
.longOpt("savepointRestoreMode")

@@ -137,6 +156,16 @@ private String globalPipelineConfig() throws Exception {
+ " CDC pipelines\n"
+ " -h,--help Display help message\n"
+ " --jar <arg> JARs to be submitted together with the pipeline\n"
+ " -rm,--restoreMode <arg> Defines how should we restore from the given\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we consider other savepoint settings like allowNonRestoredState?

@lvyanquan
Copy link
Contributor Author

Addressed it.

Copy link
Contributor

@leonardBang leonardBang left a comment

Choose a reason for hiding this comment

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

Thanks @lvyanquan for the update, LGTM

@PRNDA
Copy link

PRNDA commented Mar 4, 2024

Work like a charm.

@lvyanquan
Copy link
Contributor Author

Rebased to master.

Copy link
Contributor

@PatrickRen PatrickRen left a comment

Choose a reason for hiding this comment

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

@lvyanquan Thanks for the pull request! I left a comment.

Copy link
Contributor

@PatrickRen PatrickRen left a comment

Choose a reason for hiding this comment

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

@lvyanquan Thanks for the update! LGTM.

@PatrickRen PatrickRen changed the title [cdc-cli] support recover from a specific savepoint file [FLINK-34613][cdc] Support recover from a specific savepoint file Apr 9, 2024
@PatrickRen PatrickRen merged commit b10a666 into apache:master Apr 9, 2024
15 checks passed
@monologuist
Copy link

@lvyanquan hi,请问您这个PR,所预期的从savepoint重启Flink CDC Pipeline作业的规范命令是这样吗?

在${FLINK_CDC_HOME}目录下执行:
$ ./bin/flink-cdc.sh mysql-to-doris.yaml -s /tmp/flink-savepoints/savepoint-cca7bc-bb1e257f0dab

因为我没有看到明确的重启命令说明*,所以对此怀有疑惑。并且我认为应当明确指出。

*您引用的链接中,我看到的仍是针对jar作业的重启方式。
$ ./bin/flink run
--detached \
--from-savepoint /tmp/flink-savepoints/savepoint-cca7bc-bb1e257f0dab
./FlinkCDCExample.jar

@monologuist
Copy link

@lvyanquan hi,请问您这个PR,所预期的从savepoint重启Flink CDC Pipeline作业的规范命令是这样吗?

在${FLINK_CDC_HOME}目录下执行:
$ ./bin/flink-cdc.sh mysql-to-doris.yaml -s /tmp/flink-savepoints/savepoint-cca7bc-bb1e257f0dab

因为我没有看到明确的重启命令说明*,所以对此怀有疑惑。并且我认为应当明确指出。

*您引用的链接中,我看到的仍是针对jar作业的重启方式。 $ ./bin/flink run --detached \ --from-savepoint /tmp/flink-savepoints/savepoint-cca7bc-bb1e257f0dab ./FlinkCDCExample.jar

经多次测试,我确认这个命令可行。

wuzhenhua01 pushed a commit to wuzhenhua01/flink-cdc-connectors that referenced this pull request Aug 4, 2024
ChaomingZhangCN pushed a commit to ChaomingZhangCN/flink-cdc that referenced this pull request Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Doc] restart pipeline job from a specific savepoint file.
6 participants