You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/01/11 18:08:14 UTC

[GitHub] [flink] carp84 commented on pull request #14611: [FLINK-13194][docs] Add explicit clarification about thread-safety of state

carp84 commented on pull request #14611:
URL: https://github.com/apache/flink/pull/14611#issuecomment-758126666


   Thanks for creating the PR @Myasuka but I think the current changes are not that on track.
   
   I think we should refine/add documents in multiple places, including:
   1. As @StefanRRichter pointed out in the [JIRA comment](https://issues.apache.org/jira/browse/FLINK-13072?focusedCommentId=16879099&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16879099), the [javadoc](https://github.com/apache/flink/blob/master/flink-runtime/src/main/java/org/apache/flink/runtime/state/StateBackend.java#L85-L88) of `StateBackend` interface means the creation of backend instances should be thread-safe (although I'm even not 100% sure whether this is true in our current implementations) and we should refine it to be more clear.
   2. We should add document in the `KeyedStateBackend` interface to clearly clarify that these interfaces are not thread-safe.
   3. We need to add an entry in our [state document](https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/state/) about the single-threaded model of state access. Maybe an entry like "Thread safety of state access" with some simple contents like "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. For the same reason, state access should be single-threaded and reading/writing states with multiple threads in user-defined-functions are not supported"
   
   And I suggest we write a blog to further describe the single-threaded modeling of Flink operators and what kind of result breaking the rule would lead to in the perspective of state (such as the snapshotted data might be modified unexpectedly).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org