Apache Flink如何从检查点/保存点恢复状态?

时间:2018-02-01 11:37:27

标签: apache-flink stream-processing

我需要知道Apache Flink如何从检查点恢复其状态,因为在运行纯粹的工作并从保存点恢复时,我看不到启动时和在操作员中看到第一个事件之间的任何差异。

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

1 个答案:

答案 0 :(得分:3)

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.

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

public void initializeState(FunctionInitializationContext context)

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.