fredia commented on code in PR #19907:
URL: https://github.com/apache/flink/pull/19907#discussion_r895525160


##########
flink-runtime/src/main/java/org/apache/flink/runtime/state/TaskLocalStateStoreImpl.java:
##########
@@ -141,6 +158,29 @@ public void storeLocalState(
                     subtaskIndex);
         }
 
+        for (Map.Entry<OperatorID, OperatorSubtaskState> subtaskStateEntry :
+                localState.getSubtaskStateMappings()) {
+            for (KeyedStateHandle keyedStateHandle :
+                    subtaskStateEntry.getValue().getManagedKeyedState()) {
+                if (keyedStateHandle instanceof ChangelogStateBackendHandle) {
+                    ChangelogStateBackendHandle changelogStateBackendHandle =
+                            (ChangelogStateBackendHandle) keyedStateHandle;
+                    long materializationID = 
changelogStateBackendHandle.getMaterializationID();
+                    if (currentMaterializationID == null

Review Comment:
   1. Local recovery and rescaling can not happen at the same time, we can 
temporarily assume that the snapshot contains at most one materialization ID 
now.
   2. Even if local recovery and rescaling can happen at the same time later,  
`storeLocalState()` is called after   restoring is complete, and there is also 
at most one materialization ID per `ChangelogStateBackendHandle`, because we 
choose max materializationID to handle rescaling.
   
https://github.com/apache/flink/blob/master/flink-state-backends/flink-statebackend-changelog/src/main/java/org/apache/flink/state/changelog/ChangelogKeyedStateBackend.java#L616-L617



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to