Re: clear() in a ProcessWindowFunction

2021-04-10 Thread Vishal Santoshi
Thank you for the confirmation. The simulations confirm too. On Fri, Apr 9, 2021 at 11:14 AM Roman Khachatryan wrote: > Hi Vishal, > > Sorry for the late reply, > Please find my answers below. > By state I assume the state obtained via getRuntimeContext (access to > window state is not allowed).

Re: clear() in a ProcessWindowFunction

2021-04-09 Thread Roman Khachatryan
Hi Vishal, Sorry for the late reply, Please find my answers below. By state I assume the state obtained via getRuntimeContext (access to window state is not allowed).. > The state is scoped to the key (created per key in the ProcessWindowFunction > with a ttl ) Yes. > The state will remain aliv

Re: clear() in a ProcessWindowFunction

2021-03-31 Thread Vishal Santoshi
I had a query Say I have a single key with 2 live sessions ( A and B ) with a configured lateness . Do these invariants hold? * The state is scoped to the key (created per key in the ProcessWindowFunction with a ttl ) * The state will remain alive irrespective of whether the Window is closed or n

Re: clear() in a ProcessWindowFunction

2021-03-12 Thread Vishal Santoshi
Yep, makes sense. On Fri, Mar 12, 2021 at 10:12 AM Roman Khachatryan wrote: > > Want to confirm that the keys are GCed ( along with state ) once the > (windows close + lateness ) ? > Window state is cleared (as well as the window itself), but global > state is not (unless you use TTL). > > [1] >

Re: clear() in a ProcessWindowFunction

2021-03-12 Thread Roman Khachatryan
> Want to confirm that the keys are GCed ( along with state ) once the > (windows close + lateness ) ? Window state is cleared (as well as the window itself), but global state is not (unless you use TTL). [1] https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/state/state.html#sta

Re: clear() in a ProcessWindowFunction

2021-03-12 Thread Vishal Santoshi
Sometimes writing it down makes you think. I now realize that this is not the right approach, given that merging windows will have their own states..and how the merge happens is really at the key level On Fri, Mar 12, 2021 at 6:27 AM Vishal Santoshi wrote: > I intend to augment every event

Re: clear() in a ProcessWindowFunction

2021-03-12 Thread Vishal Santoshi
I intend to augment every event in a session with a unique ID. To keep the session lean, there is a PurgingTrigger on this aggregate that fires on a count of 1. >> (except that the number of keys can grow). Want to confirm that the keys are GCed ( along with state ) once the (windows close + l

Re: clear() in a ProcessWindowFunction

2021-03-12 Thread Roman Khachatryan
Hi Vishal, There is no leak in the code you provided (except that the number of keys can grow). But as you figured out the state is scoped to key, not to window+key. Could you explain what you are trying to achieve and why do you need to combine sliding windows with state scoped to window+key? R

Re: clear() in a ProcessWindowFunction

2021-03-11 Thread Vishal Santoshi
Essentially, Does this code leak state private static class SessionIdProcessWindowFunction extends ProcessWindowFunction, KeyedSessionWithSessionID< KEY, VALUE>, KEY, TimeWindow> { private static final long serialVersionUID = 1L; private final static ValueStateDescriptor sessionId = new ValueState