Github user sihuazhou commented on the issue: https://github.com/apache/flink/pull/5751 Hi @kl0u , I have changed the code to meet the comments on JIRA, but unfortunately, I found some case that could make the situation a bit complex with that architecture, that is maybe the `State.clear()` is not the last invocation on the state, for example: ```java void process() { /*stuff before state.clear() */ state.clear() /*stuff after state.clear()*/ Integer value = state.get(); // this should return the default value of ValueState or null if default value if not setted state.update(1); // this will re-add the state } ``` So, if we want to wrapper the state, we need do some works on the almost state's almost every api, not only the `clear()`, and the `list` that was used to store the cleared `keys` now has to be changed to `set` (because we need check whether a `key` has been cleared and also maybe remove it from the cleared keyset). I think this maybe a bit expensive, now I am a bit like to go back the simplest way to store the `keys` into a `list`, and loop the list to perform `process()`, what do you think?
---