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

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_r91730804
  
    --- 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 --
    
    Alright, i figured out why we can't fail here immediately. It still seems 
odd though that do not explicitly differentiate between a call to restore 
before any state was snapshotted and a broken snapshotting that doesn't return 
a state, although this applies to all other tests as well.
    
    If the test is successful f that we are getting the state that we 
snapshotted we should also have failure condition in case this does not happen; 
currently we simply enter undefined territory.


> 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