Search code examples
apache-flinkflink-streaming

Map State lifecycle in a keyed process function or windowed stream


Is MapState content automatically cleared up after the window expires or when onTimer function for that particular key is called or it has to be manually cleared given a TTL config is not defined


Solution

  • Any state you register yourself and that doesn't have TTL defined will be retained indefinitely.

    Flink's built-in windows are cleaned up automatically, but windows you implement yourself in a KeyedProcessFunction using MapState need to be manually cleared when they are no longer useful.