You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/07/20 23:00:45 UTC

[GitHub] [flink] rkhachatryan commented on a diff in pull request #19907: [FLINK-27692][state] Support local recovery for materialized part of changelog

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


##########
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. Yes, but this method is called after the actual recovery - when reporting a new checkpoint
   2. Yes, but relying on it seems fragile
   
   How about adding an explicit check like this:
   ```
                       if (mapToMaterializationId.containsKey(checkpointId)) {
                           checkState(materializationID == mapToMaterializationId.get(checkpointId));
                       } else {
                           mapToMaterializationId.put(checkpointId, materializationID);
                       }
   ```
   
   and removing 
   ```
   if (mapToMaterializationId.getOrDefault(checkpointId, Long.MAX_VALUE)
           < materializationID) {
       LOG.info(
   ```
   ?



-- 
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-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org