You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Garvit Sharma <ga...@gmail.com> on 2018/05/25 02:26:12 UTC

Regarding Keyed State of Connected Stream

Hi,

Let's consider, I have two keyed streams one for rules and another for data
and I have created a connected stream.

I am maintaining a managed keyed state (ValueState), rules stream will keep
updating the state and data stream will keep reading from it.

Do I need to take a lock explicitly while updating the state or not?

I need to understand.

Please let me know.

Thanks,

-- 

Garvit Sharma
github.com/garvitlnmiit/

No Body is a Scholar by birth, its only hard work and strong determination
that makes him master.

Re: Regarding Keyed State of Connected Stream

Posted by sihua zhou <su...@163.com>.
Hi Garvit,


If you don't mind to take a look at the source code, I would suggest you to have a look at the "StreamTwoInputProcessor#processInput()" in StreamTwoInputProcessor.java. Your customer function will be called via here, the "CoFlatMapFunction#flatMap1()" will be called via streamOperator.processElement1(record);", "CoFlatMapFunction#flatMap2()" will be called via streamOperator.processElement2(record);". You could follow the calling chain to find more detail if you want.


Best, Sihua






On 05/25/2018 14:05,Garvit Sharma<ga...@gmail.com> wrote:
Hi Sihua,


Thanks for the quick response. 


Could you please let me know, where can I find more details about it.




Thanks,


On Fri, May 25, 2018 at 11:04 AM, sihua zhou <su...@163.com> wrote:

Hi Garvit,

I think you don't need to lock it, they are executed in the same thread sync.

Best, Sihua






在2018年05月25日 10:26,Garvit Sharma 写道:
Hi,

Let's consider, I have two keyed streams one for rules and another for data and I have created a connected stream.

I am maintaining a managed keyed state (ValueState), rules stream will keep updating the state and data stream will keep reading from it.

Do I need to take a lock explicitly while updating the state or not?

I need to understand. 

Please let me know.

Thanks,

--

Garvit Sharma
github.com/garvitlnmiit/

No Body is a Scholar by birth, its only hard work and strong determination that makes him master.






--


Garvit Sharma
github.com/garvitlnmiit/

No Body is a Scholar by birth, its only hard work and strong determination that makes him master.

Re: Regarding Keyed State of Connected Stream

Posted by Garvit Sharma <ga...@gmail.com>.
Hi Sihua,

Thanks for the quick response.

Could you please let me know, where can I find more details about it.


Thanks,

On Fri, May 25, 2018 at 11:04 AM, sihua zhou <su...@163.com> wrote:

> Hi Garvit,
>
> I think you don't need to lock it, they are executed in the same thread
> sync.
>
> Best, Sihua
>
>
>
>
>
>
> 在2018年05月25日 10:26,Garvit Sharma <ga...@gmail.com> 写道:
> Hi,
>
> Let's consider, I have two keyed streams one for rules and another for
> data and I have created a connected stream.
>
> I am maintaining a managed keyed state (ValueState), rules stream will
> keep updating the state and data stream will keep reading from it.
>
> Do I need to take a lock explicitly while updating the state or not?
>
> I need to understand.
>
> Please let me know.
>
> Thanks,
>
> --
>
> Garvit Sharma
> <http://github.com/garvitlnmiit/>github.com/garvitlnmiit/
>
> No Body is a Scholar by birth, its only hard work and strong determination
> that makes him master.
>



-- 

Garvit Sharma
github.com/garvitlnmiit/

No Body is a Scholar by birth, its only hard work and strong determination
that makes him master.

Re: Regarding Keyed State of Connected Stream

Posted by sihua zhou <su...@163.com>.
Hi Garvit,

I think you don't need to lock it, they are executed in the same thread sync.

Best, Sihua





在2018年05月25日 10:26,Garvit Sharma 写道:
Hi,

Let's consider, I have two keyed streams one for rules and another for data and I have created a connected stream.

I am maintaining a managed keyed state (ValueState), rules stream will keep updating the state and data stream will keep reading from it.

Do I need to take a lock explicitly while updating the state or not?

I need to understand. 

Please let me know.

Thanks,

--

Garvit Sharma
github.com/garvitlnmiit/

No Body is a Scholar by birth, its only hard work and strong determination that makes him master.