Search code examples
apache-flinkflink-streaming

Flink managed state as transient


Why is it important to mark flink state as transient.

Example below uses ValueState and is marked as transient. https://nightlies.apache.org/flink/flink-docs-master/docs/dev/datastream/fault-tolerance/state/#using-keyed-state


Solution

  • The RichFunction is serialized by the Flink client and sent to the Flink cluster, where each task manager will deserialize a copy of it. It doesn't make sense for the ValueState object to be included -- instead we want each task manager to have its own ValueState object that gets initialized in the open method.