Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2939#discussion_r91724133
  
    --- Diff: 
flink-tests/src/test/java/org/apache/flink/test/classloading/jar/CheckpointedStreamingProgram.java
 ---
    @@ -72,34 +74,27 @@ public void run(SourceContext<String> ctx) throws 
Exception {
                public void cancel() {
                        running = false;
                }
    -
    -           @Override
    -           public Integer snapshotState(long checkpointId, long 
checkpointTimestamp) throws Exception {
    -                   return null;
    -           }
    -
    -           @Override
    -           public void restoreState(Integer state) {
    -
    -           }
        }
     
    -   public static class StatefulMapper implements MapFunction<String, 
String>, Checkpointed<StatefulMapper>, CheckpointListener {
    +   public static class StatefulMapper implements MapFunction<String, 
String>, ListCheckpointed<StatefulMapper>, CheckpointListener {
     
                private String someState;
                private boolean atLeastOneSnapshotComplete = false;
                private boolean restored = false;
     
                @Override
    -           public StatefulMapper snapshotState(long checkpointId, long 
checkpointTimestamp) throws Exception {
    -                   return this;
    +           public List<StatefulMapper> snapshotState(long checkpointId, 
long timestamp) throws Exception {
    +                   return Collections.singletonList(this);
                }
     
                @Override
    -           public void restoreState(StatefulMapper state) {
    -                   restored = true;
    -                   this.someState = state.someState;
    -                   this.atLeastOneSnapshotComplete = 
state.atLeastOneSnapshotComplete;
    +           public void restoreState(List<StatefulMapper> state) throws 
Exception {
    +                   if (!state.isEmpty()) {
    --- End diff --
    
    If the state is empty we should fail immediately; currently (I think) this 
would cause us to fail with the RuntimeException saying "Intended failure, to 
trigger restore", which is a bit inaccurate.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to