You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by bh...@apache.org on 2020/02/19 21:42:18 UTC

[samza] branch master updated: SAMZA-2463: Duplicate firings of processing timers (#1282)

This is an automated email from the ASF dual-hosted git repository.

bharathkk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/samza.git


The following commit(s) were added to refs/heads/master by this push:
     new 9849c37  SAMZA-2463: Duplicate firings of processing timers (#1282)
9849c37 is described below

commit 9849c37887c8875b8bb270a6194b0d98609fa465
Author: mynameborat <bh...@gmail.com>
AuthorDate: Wed Feb 19 13:42:08 2020 -0800

    SAMZA-2463: Duplicate firings of processing timers (#1282)
    
    Remove the keys from the local book keeping map directly instead of using the keySet and removeAll
---
 .../main/java/org/apache/samza/scheduler/EpochTimeScheduler.java    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/samza-core/src/main/java/org/apache/samza/scheduler/EpochTimeScheduler.java b/samza-core/src/main/java/org/apache/samza/scheduler/EpochTimeScheduler.java
index ddc5b29..cbebbde 100644
--- a/samza-core/src/main/java/org/apache/samza/scheduler/EpochTimeScheduler.java
+++ b/samza-core/src/main/java/org/apache/samza/scheduler/EpochTimeScheduler.java
@@ -90,7 +90,11 @@ public class EpochTimeScheduler {
 
   public Map<TimerKey<?>, ScheduledCallback> removeReadyTimers() {
     final Map<TimerKey<?>, ScheduledCallback> timers = new TreeMap<>(readyTimers);
-    readyTimers.keySet().removeAll(timers.keySet());
+    // Remove keys on the map directly instead of using key set iterator and remove all
+    // on the key set as it results in duplicate firings due to weakly consistent SetView
+    for (TimerKey<?> key : timers.keySet()) {
+      readyTimers.remove(key);
+    }
     return timers;
   }