[ 
https://issues.apache.org/jira/browse/FLINK-4415?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aljoscha Krettek updated FLINK-4415:
------------------------------------
    Description: 
Currently, when a {{Trigger}} returns {{PURGE}} (or {{FIRE_AND_PURGE}}) the 
window state, trigger state and timer state are completely deleted. Some use 
cases might only want to have the window contents deleted. In addition, 
triggers have no way of reacting to garbage collection, i.e. the time when 
allowed lateness expires and we completely clean up everything.

I want to propose to add these two new methods:

{code}
void onFire(...)
boolean onCleanup(...)
{code}

The {{onFire()}} is called when a window fires and we emit data. This gives the 
trigger the chance to reset/cleanup state. {{onCleanup()}} gives the trigger 
the chance to emit one final result before everything is purged, and also 
allows to cleanup data, i.e. it also replaces {{clear()}}. The window operator 
will not purge window state and timers anymore but call {{Trigger.onFire()}} to 
give it a chance to decide whether to delete state and timers.

The behavior of already existing triggers will be preserved by keeping 
{{clear()}} and calling it in a default implementation of both {{onFire()}} and 
{{onCleanup()}}, the two places where the window operator would previously call 
{{clear()}} on the trigger directly.

  was:
Currently, when a {{Trigger}} returns {{PURGE}} (or {{FIRE_AND_PURGE}}) the 
window state, trigger state and timer state are completely deleted. Some use 
cases might only want to have the window contents deleted. In addition, 
triggers have no way of reacting to garbage collection, i.e. the time when 
allowed lateness expires and we completely clean up everything.

I want to propose to add these two new methods:

{code}
void onFire(...)
boolean onCleanup(...)
{code}

The {{onFire()}} is called when a window fires and we emit data. This gives the 
trigger the chance to reset/cleanup state. {{onCleanup()}} gives the trigger 
the chance to emit one final result before everything is purged, and also 
allows to cleanup data, i.e. it also replaces {{clear()}}. The window operator 
will not purge window state and timers anymore but call {{Trigger.onFire()}} to 
give it a chance to decide whether to delete state and timers.


> Enhance Trigger Interface with onFire() and onCleanup()
> -------------------------------------------------------
>
>                 Key: FLINK-4415
>                 URL: https://issues.apache.org/jira/browse/FLINK-4415
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Streaming
>            Reporter: Aljoscha Krettek
>            Assignee: Kostas Kloudas
>
> Currently, when a {{Trigger}} returns {{PURGE}} (or {{FIRE_AND_PURGE}}) the 
> window state, trigger state and timer state are completely deleted. Some use 
> cases might only want to have the window contents deleted. In addition, 
> triggers have no way of reacting to garbage collection, i.e. the time when 
> allowed lateness expires and we completely clean up everything.
> I want to propose to add these two new methods:
> {code}
> void onFire(...)
> boolean onCleanup(...)
> {code}
> The {{onFire()}} is called when a window fires and we emit data. This gives 
> the trigger the chance to reset/cleanup state. {{onCleanup()}} gives the 
> trigger the chance to emit one final result before everything is purged, and 
> also allows to cleanup data, i.e. it also replaces {{clear()}}. The window 
> operator will not purge window state and timers anymore but call 
> {{Trigger.onFire()}} to give it a chance to decide whether to delete state 
> and timers.
> The behavior of already existing triggers will be preserved by keeping 
> {{clear()}} and calling it in a default implementation of both {{onFire()}} 
> and {{onCleanup()}}, the two places where the window operator would 
> previously call {{clear()}} on the trigger directly.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to