Myasuka commented on a change in pull request #11491: 
[FLINK-16513][checkpointing] Unaligned checkpoints: checkpoint metadata
URL: https://github.com/apache/flink/pull/11491#discussion_r397384347
 
 

 ##########
 File path: 
flink-streaming-java/src/test/java/org/apache/flink/streaming/util/OperatorSnapshotUtil.java
 ##########
 @@ -79,6 +81,28 @@ public static void writeStateHandle(OperatorSubtaskState 
state, String path) thr
                                dos.writeInt(-1);
                        }
 
+                       Collection<InputChannelStateHandle> 
inputChannelStateHandles  = state.getInputChannelState();
+                       if (inputChannelStateHandles != null) {
+                               dos.writeInt(inputChannelStateHandles.size());
+                               for (InputChannelStateHandle 
inputChannelStateHandle : inputChannelStateHandles) {
+                                       
MetadataV3Serializer.INSTANCE.serializeInputChannelStateHandle(inputChannelStateHandle,
 dos);
+                               }
+                       } else {
+                               // this means no states, not even an empty list
+                               dos.writeInt(-1);
+                       }
+
+                       Collection<ResultSubpartitionStateHandle> 
resultSubpartitionStateHandles  = state.getResultSubpartitionState();
 
 Review comment:
   Since `state.getResultSubpartitionState()` would always return a collection 
instead of `null`, the condition to judge whether 
`resultSubpartitionStateHandles` is `null` is meaningless. Moreover, we could 
remove the line of `dos.writeInt(-1);`
   This could be applied to other state snapshot in this class.

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