Savepoint

Paimon has its own snapshot management, this may conflict with Flink’s checkpoint management, causing exceptions when restoring from savepoint (don’t worry, it will not cause the storage to be damaged).

It is recommended that you use the following methods to savepoint:

  1. Use Flink Stop with savepoint.
  2. Use Paimon Tag with Flink Savepoint, and rollback-to-tag before restoring from savepoint.

Stop with savepoint

This feature of Flink ensures that the last checkpoint is fully processed, which means there will be no more uncommitted metadata left. This is very safe, so we recommend using this feature to stop and start job.

Tag with Savepoint

In Flink, we may consume from kafka and then write to paimon. Since flink’s checkpoint only retains a limited number, we will trigger a savepoint at certain time (such as code upgrades, data updates, etc.) to ensure that the state can be retained for a longer time, so that the job can be restored incrementally.

Paimon’s snapshot is similar to flink’s checkpoint, and both will automatically expire, but the tag feature of paimon allows snapshots to be retained for a long time. Therefore, we can combine the two features of paimon’s tag and flink’s savepoint to achieve incremental recovery of job from the specified savepoint.

Starting from Flink 1.15 intermediate savepoints (savepoints other than created with stop-with-savepoint) are not used for recovery and do not commit any side effects.

For savepoint created with stop-with-savepoint, tags will be created automatically. For other savepoints, tags will be created after the next checkpoint succeeds.

Step 1: Enable automatically create tags for savepoint.

You can set sink.savepoint.auto-tag to true to enable the feature of automatically creating tags for savepoint.

Step 2: Trigger savepoint.

You can refer to flink savepoint to learn how to configure and trigger savepoint.

Step 3: Choose the tag corresponding to the savepoint.

The tag corresponding to the savepoint will be named in the form of savepoint-${savepointID}. You can refer to Tags Table to query.

Step 4: Rollback the paimon table.

Rollback the paimon table to the specified tag.

Step 5: Restart from the savepoint.

You can refer to here to learn how to restart from a specified savepoint.