rkhachatryan commented on code in PR #19448: URL: https://github.com/apache/flink/pull/19448#discussion_r873845873
########## flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/OperatorSubtaskState.java: ########## @@ -227,6 +229,14 @@ private static void registerSharedState( for (KeyedStateHandle stateHandle : stateHandles) { if (stateHandle != null) { stateHandle.registerSharedStates(sharedStateRegistry, checkpointID); + // Registering state handle to the given sharedStateRegistry serves two purposes: + // 1. let sharedStateRegistry be responsible for cleaning the state handle, Review Comment: I think deletion by the `SharedStateRegistry` can and should be avoided. Checkpoint will be discarded once no state is in use, which will also discard the private state. And it's better to keep it this way (`CheckpointCleaner`, rather than `SharedStateRegistry`) because the back-pressure mechanism there is better; and the purpose of registering here is to simply "mark" the **checkpoint** as used. So I propose to have an empty `discardState` method in the wrapper (that would also allow to replace `keyedStateHandle` in it with only an ID). WDYT? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org