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 2021/03/04 16:08:15 UTC

[GitHub] [flink] rkhachatryan commented on a change in pull request #14754: [FLINK-21127][runtime][checkpoint] Stores finished status for fully finished operators in checkpoint

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



##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/OperatorState.java
##########
@@ -118,14 +142,30 @@ public ByteStreamStateHandle getCoordinatorState() {
     }
 
     public Map<Integer, OperatorSubtaskState> getSubtaskStates() {
+        return getSubtaskStates(false);
+    }
+
+    public Map<Integer, OperatorSubtaskState> getSubtaskStates(boolean includeFinishedFlag) {
+        if (!includeFinishedFlag && isFullyFinished()) {
+            return Collections.emptyMap();
+        }
+
         return Collections.unmodifiableMap(operatorSubtaskStates);
     }
 
     public Collection<OperatorSubtaskState> getStates() {
+        if (isFullyFinished()) {
+            return Collections.emptySet();
+        }

Review comment:
       I'm not sure that this check is needed. If `isFullyFinished` then `subtaskStates` should be empty anyways. So continuing wouldn't hurt but the check makes me feel that it's **necessary** in **all** methods.
   
   ditto: other methods
   
   Probably a subclass `FinishedOperatorState` with always empty state would make it easier and less error-prone, 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:
users@infra.apache.org