Search code examples
apache-flinkflink-streaming

Flink add a TTL to an existing value state


For one of our Flink jobs, we found a state causing a state leak. To fix this we need to add a TTL to the state causing the leak, however, we would like to keep existing state(savepoint). If we add a TTL to a value state would we be able to use the existing savepoint? Thank you.


Solution

  • No, according to the docs this won't work:

    Trying to restore state, which was previously configured without TTL, using TTL enabled descriptor or vice versa will lead to compatibility failure and StateMigrationException.

    However, you may be able to use the state processor API to accomplish this.

    However, exactly how you should handle this depends on what kind of state it is, how it was serialized, and whether the operator has a UID.