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

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

GitHub user gyfora opened a pull request:

    https://github.com/apache/flink/pull/1154

    [FLINK-2713] [streaming] Set state restore to lazy to avoid 
StateCheckpointer issues and reduce checkpoint overhead

    Currently failure recovery fails when using custom StateCheckpointers 
because they are not correctly set before trying to restore the operator 
initial state. This PR solves this issue by making state restore lazy (only 
happens if the user wants to access the value of the state)
    
    The current order of events and the problem:
     1. Create StreamTask
     2. Call restoreInitialState(snapshot) -> default java-serialization 
StateCheckpointer is used
     2. Open UDF and run computation. -> This is the point when custom 
StateCheckpointers are set
     2. Take snapshots....
    We can see while the custom StateCheckpointers are available and work for 
taking snapshots they are not set set yet when call restore which obviously 
leads to error.
    
    The change is:
     1. Create StreamTask
     2. Call restoreInitialState(snapshot) -> state is not restored yet, but a 
flag is set
     3. Open UDF and run computation. -> This is the point when custom 
StateCheckpointers are set
     4. The state is restored when the user accesses the value
     5. Take snapshots... (just return the last checkpoint if not restored yet)
    
    The PR also extends the StreamCheckpointingITCase and the 
PartitionedStateCheckpointingITCase to include a case for custom 
StateCheckpointers for both local and partitioned OperatorStates.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/gyfora/flink lazyrestore

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/1154.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1154
    
----
commit d1e590cbfcf9296a90aa846fd6dc49d9c7a0f077
Author: Gyula Fora <[email protected]>
Date:   2015-09-21T10:07:47Z

    [FLINK-2713] [streaming] Set state restore to lazy to avoid 
StateCheckpointer issues and reduce checkpoint overhead

----


> Custom StateCheckpointers should be included in the snapshots
> -------------------------------------------------------------
>
>                 Key: FLINK-2713
>                 URL: https://issues.apache.org/jira/browse/FLINK-2713
>             Project: Flink
>          Issue Type: Bug
>          Components: Streaming
>            Reporter: Gyula Fora
>            Assignee: Gyula Fora
>
> Currently the restoreInitialState call fails when the user uses a custom 
> StateCheckpointer to create the snapshot, because the state is restored 
> before the StateCheckpointer is set for the StreamOperatorState. (because the 
> restoreInitialState() call precedes the open() call)
> To avoid this issue, the custom StateCheckpointer instance should be stored 
> within the snapshot and should be set in the StreamOperatorState before 
> calling restoreState(..).
> To reduce the overhead induced by this we can do 2 optimizations:
>  - We only include custom StateCheckpointers (the default java serializer one 
> is always available)
>  - We only serialize the checkpointer once and store the byte array in the 
> snapshot



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

Reply via email to