You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by pn...@apache.org on 2021/09/06 07:54:12 UTC
[flink] 02/04: [refactor][streaming] Improved description of the
calculation of the processing time delay
This is an automated email from the ASF dual-hosted git repository.
pnowojski pushed a commit to branch release-1.14
in repository https://gitbox.apache.org/repos/asf/flink.git
commit 6fa603327c7a2aeda0c2416c36e763949832da02
Author: Anton Kalashnikov <ka...@yandex.ru>
AuthorDate: Wed Sep 1 15:30:57 2021 +0200
[refactor][streaming] Improved description of the calculation of the processing time delay
---
.../streaming/runtime/tasks/ProcessingTimeServiceUtil.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/ProcessingTimeServiceUtil.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/ProcessingTimeServiceUtil.java
index c718f49..3733d8a 100644
--- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/ProcessingTimeServiceUtil.java
+++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/ProcessingTimeServiceUtil.java
@@ -26,6 +26,8 @@ public class ProcessingTimeServiceUtil {
/**
* Returns the remaining delay of the processing time specified by {@code processingTimestamp}.
+ * This delay guarantees that the timer will be fired at least 1ms after the time it's
+ * registered for.
*
* @param processingTimestamp the processing time in milliseconds
* @param currentTimestamp the current processing timestamp; it usually uses {@link
@@ -36,9 +38,11 @@ public class ProcessingTimeServiceUtil {
// Two cases of timers here:
// (1) future/now timers(processingTimestamp >= currentTimestamp): delay the firing of the
- // timer by 1 ms to align the semantics with watermark. A watermark T says we won't see
- // elements in the future with a timestamp smaller or equal to T. With processing time, we
- // therefore need to delay firing the timer by one ms.
+ // timer by 1 ms to align the semantics with watermark. A watermark T says we
+ // won't see elements in the future with a timestamp smaller or equal to T. Without this
+ // 1ms delay, if we had fired the timer for T at the timestamp T, it would be possible
+ // that we would process another record for timestamp == T in the same millisecond, but
+ // after the timer for the timsetamp T has already been fired.
// (2) past timers(processingTimestamp < currentTimestamp): do not need to delay the firing
// because currentTimestamp is larger than processingTimestamp pluses the 1ms offset.
// TODO. The processing timers' performance can be further improved.