Hi Dan,

Currently, event-time TTL hasn't been supported due to implementation 
complexity and ambiguous semantics which need more discussion[1][2].

So people usually use state TTL with processing-time characteristics[3]. Could 
the processing-time ttl state meet your requirements in your case?

If yes, you can refer the flink documentation[3][4] about how to use state TTL.

[1] https://issues.apache.org/jira/browse/FLINK-12005
[2] https://lists.apache.org/thread/8nhs2dfthh6whstn1j200tpq7pbjx1lh
[3] 
https://nightlies.apache.org/flink/flink-docs-release-1.14/docs/dev/datastream/fault-tolerance/state/#state-time-to-live-ttl
[4] https://flink.apache.org/2019/05/19/state-ttl.html

Best regards,
Jinzhong, Li


On 2022/01/10 04:39:43 Dan Hill wrote:
> Hi.  Any updates on this?
> 
> How do people usually do TTLs?  I want to add a backup TTL in case I have
> leaky state.
> 
> On Wed, Jun 17, 2020 at 6:08 AM Andrey Zagrebin <az...@apache.org>
> wrote:
> 
> > Hi Arti,
> >
> > Any program can use State with TTL but the state can only expire in
> > processing time at the moment even if you configure event-time
> > characteristics.
> > As Congxian mentioned, the event time for TTL is planned.
> >
> > The cleanup says that it will not be removed 'by default'. The following
> > sections [1] describe background cleanup which is not activated 'by
> > default' in 1.9 but in 1.10.
> > If you activate the background cleanup, you do not have to read the
> > expired state to clean it up as if you have those timers you mentioned.
> > See also the docs for details about background cleanup caveats.
> >
> > The timers approach is a valid way but heavy-weight in terms of storage
> > because Flink will have to create a separate state for timers:
> > key/timestamp.
> > The timers approach is not implemented in Flink out-of-the-box at the
> > moment. It can be implemented in the application as a simple background
> > cleanup.
> >
> > Best,
> > Andrey
> >
> > [1]
> > https://ci.apache.org/projects/flink/flink-docs-release-1.9/dev/stream/state/state.html#cleanup-in-background
> >
> > On Wed, Jun 17, 2020 at 3:07 PM Congxian Qiu <qc...@gmail.com>
> > wrote:
> >
> >> Hi
> >>  Currently, Flink does not support event-time TTL state, there is an
> >> issue[1] tracking this.
> >> [1] https://issues.apache.org/jira/browse/FLINK-12005
> >> Best,
> >> Congxian
> >>
> >>
> >> Arti Pande <pa...@gmail.com> 于2020年6月17日周三 下午7:37写道:
> >>
> >>> With Flink 1.9 is state TTL supported for event-time characteristics? This
> >>> part
> >>> <https://ci.apache.org/projects/flink/flink-docs-release-1.9/dev/stream/state/state.html#state-time-to-live-ttl>
> >>> of the documentation says that
> >>>
> >>>
> >>>    -
> >>>
> >>>    Only TTLs in reference to *processing time* are currently supported.
> >>>
> >>> Does this mean if a program uses event-time characteristics with
> >>> stateful operators, it can not use TTL ??
> >>>
> >>> Also clean up section
> >>> <https://ci.apache.org/projects/flink/flink-docs-release-1.9/dev/stream/state/state.html#cleanup-of-expired-state>
> >>>  of
> >>> the documentation says state values that are never read will never be
> >>> cleared.
> >>> [image: Screenshot 2020-06-17 at 5.00.41 PM.png]
> >>> The question is, when processing a stream with unique elements or
> >>> keys why would Flink framework expect the same key to be read in order for
> >>> it to be removed after its expiration time ? Why does it not simply clean
> >>> up the value for that key based on timers automatically without waiting 
> >>> for
> >>> read operation from user code?
> >>>
> >>> Thanks
> >>> Arti
> >>>
> >>
> 

Reply via email to