you to store operator state as BLOB directly if that would be a
>doable option for you.
>
>
>
> Sincere greetings
>
>
>
> Thias
>
>
>
>
>
>
>
>
>
> *From:* Zakelly Lan
> *Sent:* Wednesday, February 21, 2024 8:04 AM
> *To:* Lorenzo Nicora
> *Cc:* Flin
directly if that would be a doable option for
you.
Sincere greetings
Thias
From: Zakelly Lan
Sent: Wednesday, February 21, 2024 8:04 AM
To: Lorenzo Nicora
Cc: Flink User Group
Subject: Re: Preparing keyed state before snapshot
⚠EXTERNAL MESSAGE – CAUTION: Think Before You Click ⚠
Hi Lorenzo
Hi Lorenzo,
I think the most convenient way is to modify the code of the state backend,
adding a k-v cache as you want.
Otherwise IIUC, there's no public interface to get keyContext. But well,
you may try something hacky. You may use the passed-in `Context` instance
in processElement, and leverag
Thanks Zakelly,
I'd need to do something similar, with a map containing my non-serializable
"state", similar to the kvCache in FastTop1Fucntion.
But I am not sure I understand how I can set the keyed state for a specific
key, in snapshotState().
FastTop1Function seems to rely on keyContext set vi
Hi Lorenzo,
It is not recommended to do this with the keyed state. However there is an
example in flink code (FastTop1Function#snapshotState) [1] of setting keys
when snapshotState().
Hope this helps.
[1]
https://github.com/apache/flink/blob/050503c65f5c5c18bb573748ccbf5aecce4ec1a5/flink-table/f
Hi Thias
I considered CheckpointedFunction.
In snapshotState() I would have to update the state of each key, extracting
the in-memory "state" of each key and putting it in the state with
state.update(...) .
This must happen per key,
But snapshotState() has no visibility of the keys. And I have no
Good morning Lorenzo,
You may want to implement
org.apache.flink.streaming.api.checkpoint.CheckpointedFunction interface in
your KeyedProcessFunction.
Btw. By the time initializeState(…) is called, the state backend is fully
initialized and can be read and written to (which is not the case for