You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by al...@apache.org on 2017/10/24 14:24:59 UTC

flink git commit: [FLINK-7738] Add note about non-firing triggers with empty windows

Repository: flink
Updated Branches:
  refs/heads/master 4a6a94dfb -> 8c89f3c6b


[FLINK-7738] Add note about non-firing triggers with empty windows

Timer callbacks on Trigger are not called if the window is empty, they
are silently ignored. This has led to some confusion.


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/8c89f3c6
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/8c89f3c6
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/8c89f3c6

Branch: refs/heads/master
Commit: 8c89f3c6b5ebd0334176d9e7e57b38b4d39a594a
Parents: 4a6a94d
Author: Aljoscha Krettek <al...@gmail.com>
Authored: Tue Oct 24 16:23:20 2017 +0200
Committer: Aljoscha Krettek <al...@gmail.com>
Committed: Tue Oct 24 16:23:20 2017 +0200

----------------------------------------------------------------------
 .../flink/streaming/api/windowing/triggers/Trigger.java   | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/8c89f3c6/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/Trigger.java
----------------------------------------------------------------------
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/Trigger.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/Trigger.java
index 1c47de3..f29fc6f 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/Trigger.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/triggers/Trigger.java
@@ -70,6 +70,11 @@ public abstract class Trigger<T, W extends Window> implements Serializable {
 	/**
 	 * Called when a processing-time timer that was set using the trigger context fires.
 	 *
+	 * <p>Note: This method is not called in case the window does not contain any elements. Thus,
+	 * if you return {@code PURGE} from a trigger method and you expect to do cleanup in a future
+	 * invocation of a timer callback it might be wise to clean any state that you would clean
+	 * in the timer callback.
+	 *
 	 * @param time The timestamp at which the timer fired.
 	 * @param window The window for which the timer fired.
 	 * @param ctx A context object that can be used to register timer callbacks.
@@ -79,6 +84,11 @@ public abstract class Trigger<T, W extends Window> implements Serializable {
 	/**
 	 * Called when an event-time timer that was set using the trigger context fires.
 	 *
+	 * <p>Note: This method is not called in case the window does not contain any elements. Thus,
+	 * if you return {@code PURGE} from a trigger method and you expect to do cleanup in a future
+	 * invocation of a timer callback it might be wise to clean any state that you would clean
+	 * in the timer callback.
+	 *
 	 * @param time The timestamp at which the timer fired.
 	 * @param window The window for which the timer fired.
 	 * @param ctx A context object that can be used to register timer callbacks.