rkhachatryan commented on a change in pull request #15420:
URL: https://github.com/apache/flink/pull/15420#discussion_r656024850



##########
File path: 
flink-state-backends/flink-statebackend-changelog/src/main/java/org/apache/flink/state/changelog/ChangelogKeyedStateBackend.java
##########
@@ -358,7 +461,23 @@ public void notifyCheckpointAborted(long checkpointId) 
throws Exception {
                         keyedStateBackend.getKeyContext(),
                         stateChangelogWriter,
                         meta);
-        return stateFactory.create(state, kvStateChangeLogger);
+        return stateFactory.create(
+                state,
+                kvStateChangeLogger,
+                keyedStateBackend /* pass the nested backend as key context so 
that it get key updates on recovery*/);
+    }
+
+    private void completeRestore(Collection<ChangelogStateBackendHandle> 
stateHandles) {
+        if (!stateHandles.isEmpty()) {
+            synchronized (materialized) { // ensure visibility

Review comment:
       The variables updated in this method (by the task thread) are also read 
in `buildSnapshotResult`, potentially from a different thread.
   Without `synchronized` (or other means to inject memory barrier) I'm afraid 
those other threads may see not updated values.




-- 
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.

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


Reply via email to