[ 
https://issues.apache.org/jira/browse/FLINK-5113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15735515#comment-15735515
 ] 

ASF GitHub Bot commented on FLINK-5113:
---------------------------------------

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.


> Make all Testing Functions implement CheckpointedFunction Interface.
> --------------------------------------------------------------------
>
>                 Key: FLINK-5113
>                 URL: https://issues.apache.org/jira/browse/FLINK-5113
>             Project: Flink
>          Issue Type: Improvement
>          Components: DataStream API
>    Affects Versions: 1.2.0
>            Reporter: Kostas Kloudas
>            Assignee: Kostas Kloudas
>             Fix For: 1.2.0
>
>
> Currently stateful functions implement the (old) Checkpointed interface.
> This is issue aims at porting all these function to the new 
> CheckpointedFunction interface, so that they can leverage the new 
> capabilities by it. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to