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:
[email protected]


Reply via email to