Checkpoints and savepoints

Checkpoints and savepoints save the state of a job so that it can recover after a failure or continue after a change. When you turn on checkpointing, Flink creates checkpoints automatically, and you control savepoints.

Flink has a fault tolerance mechanism that creates snapshots of the data stream when you turn on checkpointing. A snapshot includes the position in the input and the state of every operator. If a job fails, Flink restarts it from the latest snapshot, which keeps the results of the computation consistent.

  • A checkpoint is a snapshot that Flink creates and manages. Flink uses it to recover a job automatically after a failure. Checkpointing is off by default. Turn on Enable Checkpointing in the job settings, and set the interval at which Flink creates checkpoints. The default checkpoint mode is At Least Once. For exactly-once processing, set Checkpoint Mode to Exactly Once.
  • A savepoint is a backup of a job that you control. Cloudera SQL Stream Builder (SSB) takes a savepoint when you stop a job that has Restore From Savepoint turned on. You can then run the job again from the savepoint, with or without changes to the job. Use savepoints for upgrades and maintenance.

Checkpoints and savepoints need a checkpoint directory and a savepoint directory in durable storage. By default, SSB uses the checkpoints and savepoints folders of the bucket that is bound to the default purpose of the engine instance. For more information, see Architecture.

In SSB, you set both in the job settings. For more information, see Configuring job settings and Managing savepoints for SQL jobs.

Some sinks depend on checkpoints. A sink that commits its transactions or finishes its files when a checkpoint completes, such as an exactly-once Kafka sink or the Filesystem sink, commits no transactions and finishes no files while checkpointing is off.

For more information about checkpoints and savepoints in Flink, see Checkpoints and Savepoints in the Apache Flink documentation.