Hi Peter Can applyToAllKeys[1] in KeyedStateBackend help you here? but currently, this is not exposed to users now.
[1] https://github.com/apache/flink/blob/fada6fb6ac9fd7f6510f1f2d77b6baa06563e222/flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyedStateBackend.java#L65 Best, Congxian Robert Metzger <rmetz...@apache.org> 于2020年10月27日周二 下午5:51写道: > Hi Peter, > > I'm adding two committers to this thread who can help answering your > question. > > On Mon, Oct 26, 2020 at 3:22 PM Peter Westermann < > no.westerm...@genesys.com> wrote: > >> We use the feature for removing stateful operators via the >> *allowNonRestoredState* relatively often and it works great. However, >> there doesn’t seem to be anything like that for removing state from an >> existing operator (that we want to keep). >> >> Say my operator defines a * MapState* and a *ValueState*. Later on, the >> *ValueState* becomes obsolete. In this case, we can remove the actual >> data for each key by clearing it out but the state itself is still >> referenced in savepoints even if it’s not referenced in code anymore – that >> e.g. means one cannot remove any class that was previously used in state. >> >> Would it be possible to add support for completely removing state from an >> operator if it’s no longer referenced in code and *allowNonRestoredState* >> is set? (Or to add an explicit “drop this state option” in KeyedStateStore >> and OperatorStateStore?) >> >> >> >> Thanks, >> >> Peter >> >> >> >