Updated on 2022-06-01 GMT+08:00

Savepoints FAQs

  1. Should I assign IDs to all operators in my job?

    As a rule of thumb, yes. Strictly speaking, it is sufficient to only assign IDs via the uid method to the stateful operators in your job. The savepoint only contains state for these operators and stateless operators are not part of the savepoint.

    In practice, it is advised to assign IDs to all operators, because some of Flink's built-in operators like the Window operator are also stateful and it is not obvious which built-in operators are actually stateful and which are not. If you are absolutely certain that an operator is stateless, you can skip the uid method.

  2. What happens if I add a new operator that requires state to my job?

    When you add a new operator to your job, it will be initialized without any state. Therefore, it is stateless and starts running from 0.

  3. What happens if I delete an operator that has state from my job?

    By default, a savepoint restore will try to match all state back to the restored job. If you restore from a savepoint that contains state for an operator that has been deleted, this will therefore fail.

    You can allow non restored state by setting the --allowNonRestoredState (short: -n) with the run command:

    $ bin/flink run -s savepointPath -n [runArgs]
  4. What happens if I reorder stateful operators in my job?
    • If you assigned IDs to these operators, they will be restored as usual.
    • If you did not assign IDs, the auto generated IDs of the stateful operators will most likely change after the reordering. This would result in you not being able to restore from a previous savepoint.
  5. What happens if I add or delete or reorder operators that have no state in my job?
    • If you assigned IDs to your stateful operators, the stateless operators will not influence the savepoint restore.
    • If you did not assign IDs, the auto generated IDs of the stateful operators will most likely change after the reordering. This would result in you not being able to restore from a previous savepoint.
  6. What happens when I change the parallelism of my program when restoring?

    If the savepoint was triggered with Flink 1.2.0 or later and using no deprecated state API like checkpointed, you can simply restore the program from a savepoint and specify a new parallelism. Otherwise, the restore will fail.