You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ming li (Jira)" <ji...@apache.org> on 2020/07/31 09:18:00 UTC

[jira] [Comment Edited] (FLINK-9373) Fix potential data losing for RocksDBBackend

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

ming li edited comment on FLINK-9373 at 7/31/20, 9:17 AM:
----------------------------------------------------------

Hi,[~sihuazhou]. Recently I was reading the related code of flink-statebackend-rocksdb, and found that in the seekToLast method of org.apache.flink.contrib.streaming.state.RocksIteratorWrapper, iterator.seekToFirst is called. I am puzzled why iterator.seekToLast is not called.
{code:java}
//代码占位符
@Override 
public void seekToLast() { 
   iterator.seekToFirst(); 
   status(); 
}
{code}


was (Author: ming li):
Hi,[~sihuazhou]. Recently I was reading the related code of flink-statebackend-rocksdb, and found that in the seekToLast method of org.apache.flink.contrib.streaming.state.RocksIteratorWrapper, iterator.seekToFirst is called. I am puzzled why iterator.seekToLast is not called.
{code:java}
//代码占位符
{code}
@Override public void seekToLast() \{ iterator.seekToFirst(); status(); }

> Fix potential data losing for RocksDBBackend
> --------------------------------------------
>
>                 Key: FLINK-9373
>                 URL: https://issues.apache.org/jira/browse/FLINK-9373
>             Project: Flink
>          Issue Type: Bug
>          Components: Runtime / State Backends
>    Affects Versions: 1.5.0
>            Reporter: Sihua Zhou
>            Assignee: Sihua Zhou
>            Priority: Blocker
>             Fix For: 1.5.0, 1.6.0
>
>
> Currently, when using RocksIterator we only use the _iterator.isValid()_ to check whether we have reached the end of the iterator. But that is not enough, if we refer to RocksDB's wiki https://github.com/facebook/rocksdb/wiki/Iterator#error-handling we should find that even if _iterator.isValid()=true_, there may also exist some internal error. A safer way to use the _RocksIterator_ is to always call the _iterator.status()_ to check the internal error of _RocksDB_. There is a case from user email seems to lost data because of this http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Missing-MapState-when-Timer-fires-after-restored-state-td20134.html



--
This message was sent by Atlassian Jira
(v8.3.4#803005)