Apache Flink 如何从检查点/保存点恢复状态? [英] How does Apache Flink restore state from checkpoint/savepoint?

查看:47
本文介绍了Apache Flink 如何从检查点/保存点恢复状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道 Apache Flink 如何从检查点恢复其状态,因为在运行纯作业与从保存点恢复时,我看不到启动时间和在运算符中看到第一个事件之间的任何区别.

I need to know how Apache Flink restore its state from checkpoint, because I can't see any difference between the time of start and seeing first event in operator when running pure job verses restoring from savepoint.

状态是否从检查点/保存点延迟加载?

Does state load lazily from checkpoint/savepoint?

推荐答案

键控状态接口旨在使这种区别变得透明.正如 Dawid 所提到的,状态是在作业启动期间加载的.请注意,加载状态的含义取决于正在使用的状态后端.

The keyed state interfaces are designed to make this distinction transparent. As Dawid mentioned, the state is loaded during job start. Note that what it means to load the state depends on which state backend is being used.

在操作符状态的情况下,CheckpointedFunction 接口有这个方法

In the case of operator state the CheckpointedFunction interface has this method

public void initializeState(FunctionInitializationContext context)

其中上下文有一个 isRestored() 方法,让您知道您是否正在从故障中恢复.请参阅 有关托管操作员状态的文档 了解更多详细信息,包括示例.

where the context has an isRestored() method that lets you know if you are recovering from a failure. See the docs on managed operator state for more details, including an example.

这篇关于Apache Flink 如何从检查点/保存点恢复状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆