好的,我看这里面邮件都是英文,所以用英文问了个问题。 我再描述一下我的问题,我使用键控状态,用的value-state。按理来说,相同的key应该会被分到同一个并行度处理。但是但我使用多个并行度的时候,我发现好像相同的key并没有分配到同一个并行度处理。具体现象在于,我的程序是对同一个用户点击的商品进行累加,在数据里这个商品已经是第二个了,但是程序里这个商品的状态是空,所以导致最终累加的结果是1,而正确结果应该是2。所以我猜测是不是算子对于value-state都是独有的。 但是当我使用mapstate的时候,这个问题好像就没有再出现了。所以我想了解这里面的原因是啥?或者有什么方法能确保同一个key的数据都会被同一个task处理。
[email protected] From: Hangxiang Yu Date: 2022-05-23 23:09 To: user-zh; lxk7491 Subject: Re: Some question with Flink state Hello, All states will not be shared in different parallelisms. BTW, English questions could be sent to [email protected]. Best, Hangxiang. On Mon, May 23, 2022 at 4:03 PM [email protected] <[email protected]> wrote: > > Hi everyone > I was used Flink keyed-state in my Project.But I found some questions > that make me confused. > when I used value-state in multi parallelism the value is not I wanted. > So I guess that value-state is in every parallelism. every parallelism > saved their only value which means the value is Thread-Level > But when I used map-state,the value is correctly. I mean the map-state > was shared by every parallelism. > looking forward to your reply > > > [email protected] >
