zhijiangW commented on a change in pull request #11534: [FLINK-16537][network] 
Implement ResultPartition state recovery for unaligned checkpoint
URL: https://github.com/apache/flink/pull/11534#discussion_r400625877
 
 

 ##########
 File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java
 ##########
 @@ -434,6 +434,13 @@ protected void beforeInvoke() throws Exception {
                        // so that we avoid race conditions in the case that 
initializeState()
                        // registers a timer, that fires before the open() is 
called.
                        
operatorChain.initializeStateAndOpenOperators(createStreamTaskStateInitializer());
+
+                       ResultPartitionWriter[] writers = 
getEnvironment().getAllWriters();
+                       if (writers != null) {
+                               for (ResultPartitionWriter writer : writers) {
+                                       writer.initializeState();
+                               }
+                       }
 
 Review comment:
   The reader would also be used for input side for recovery in another PR. 
Have you considered when to close it in your PR? The `ChannelStateReader` is a 
task-level component and passed into `Environment` to be used anywhere in 
theory. Input and output sides are the users for reader ATM, but they should 
not be aware whether there are other users. So they should not close it after 
using . The proper way might consider its lifecycle together with task's 
lifecycle. 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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to