flink Operator State is thread safe?

流过昼夜 提交于 2019-12-11 15:31:56

问题


With Operator State (or non-keyed state), each operator state is bound to one parallel operator instance

The above quote is from the official Flink website. Each parallel operator instance may have thread pool. When these threads access the Operator State (as described above, each parallel operator instance can have one operator state), would it encounter a thread-safe problem? Should I use Operator State with terminology like below in Java?

synchronize(stateInstance){
//update state
}

回答1:


I wonder what do you mean thread pool and how will it interact with Flink managed state?

If the thread pool you mentioned in the question is Flink task running on the Flink TaskManager. Then it is thread-safe. Flink is a distributed system. It executes the task with parallel operator instances, so the managed state of each operator instance is thread-safe naturally.



来源:https://stackoverflow.com/questions/55208345/flink-operator-state-is-thread-safe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!