使用Flink中的检查点功能,用户会调用prinitizestate和snapshotstate还是在幕后处理

发布于 2025-02-12 00:31:03 字数 754 浏览 1 评论 0 原文

我在此处按照一个示例: https://github.com/apache/flink/flink/blob/master/master/master/flink-streaming-java/src/src/main/java/java/java/org/org/org/org/apache/flink/streaming一下/pi/functions/source/Source/statefulSequencesource.java

我正在尝试使用jdbc连接来构建一个源,该连接扩展了RichParallEffunction并实现了CheckPointEdfunction,因为我希望能够从我的源表中保存我的水印重新启动。

在使用Docker本地测试时,我可以调用我的Run()方法,并从源数据库中读取数据,但是我不确定SnapShotState和Initializestate方法实际上是在哪里被调用的。我在那些应该基于第一个启动/恢复的方法设置我的水印值的逻辑 - 我只是从未看到访问它,并且不确定我是否应该在外部调用该方法?

感谢提前的帮助!

I am following an example here: https://github.com/apache/flink/blob/master/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/StatefulSequenceSource.java

I am trying to build a source using a jdbc connection which extends RichParallelFunction and implements CheckpointedFunction, as I would like to be able to save my watermark from my source tables in the case of restart.

When testing locally with docker, I can call my run() method just fine and read data from my source database, but I am not sure where the snapshotState and initializeState methods actually get called. I have logic in those methods that should be setting the value of my watermark based on first startup/recovery - I just never see that being accessed, and not sure if I should be calling the methods externally?

Thanks for the help in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦行七里 2025-02-19 00:31:03

当需要(执行检查点或保存点时)时,该方法将由Flink框架调用。

参见

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文