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

Stefan Richter edited comment on FLINK-13072 at 7/5/19 9:21 AM:
----------------------------------------------------------------

[~zicat] All operators in Flink are assumed to be single-threaded and spawning 
up threads in any user function is something that is not supported by the 
framework.

The quote from the doc that you present is about the `StateBackend` classes, 
which are (misleadingly named) just the factory for the actual backend 
implementations like `RocksDBKeyedStateBackend`. So yes, the factory has to be 
thread safe, but the backends (i.e. subclasses of `AbstractKeyedStateBackend`) 
and other things are not. What you attempt will not work.


was (Author: srichter):
[~zicat] All operators in Flink are assumed to be single-threaded and spawning 
up threads in any user function is something that is not supported by the 
framework.

The quote from the doc that you present is about the `StateBackend` classes, 
which are (misleadingly named) just the factory for the actual backend 
implementations like `RocksDBKeyedStateBackend`. So yes, the factory has to be 
thread safe, but the backends and other things are not. What you attempt will 
not work.

> RocksDBStateBachend is not thread safe and data loss silently
> -------------------------------------------------------------
>
>                 Key: FLINK-13072
>                 URL: https://issues.apache.org/jira/browse/FLINK-13072
>             Project: Flink
>          Issue Type: Bug
>          Components: Runtime / State Backends
>    Affects Versions: 1.8.0, 1.8.1
>            Reporter: lynn1.zhang
>            Priority: Blocker
>         Attachments: flink-demo.zip, image-2019-07-03-17-04-17-253.png
>
>
> I create 2 mapstates in oneĀ operator, then create 2 threads in apply method, 
> each thread operate each map state(the operator is same), the expect result 
> is that 2 state haveĀ the same result but not. I upload the code, please help 
> to try it.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to