Github user aljoscha commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1944#discussion_r61567670
  
    --- Diff: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperator.java
 ---
    @@ -542,14 +561,24 @@ public void registerEventTimeTimer(long time) {
                                // immediately schedule a trigger, so that we 
don't wait for the next
                                // watermark update to fire the watermark 
trigger
                                
getRuntimeContext().registerTimer(System.currentTimeMillis(), 
WindowOperator.this);
    +                           //No need to put it in 
processingTimeTimerFutures as this timer is never removed
                        }
                }
     
                @Override
                public void deleteProcessingTimeTimer(long time) {
                        Timer<K, W> timer = new Timer<>(time, key, window);
    -                   if (processingTimeTimers.remove(timer)) {
    -                           processingTimeTimersQueue.remove(timer);
    +
    +                   processingTimeTimers.remove(timer);
    +                   processingTimeTimersQueue.remove(timer);
    +
    +                   //If there are no timers left for this timestamp, 
remove it from queue and cancel TriggerTask
    +                   if (processingTimeTimerTimestamps.remove(time,1) == 1) {
    +                           ScheduledFuture<?> triggerTaskFuture = 
processingTimeTimerFutures.get(timer);
    --- End diff --
    
    This should be replaced by `processingTimeTimerFutures.remove(timer.time)`. 
The key in `processingTimeTimerFutures` is a `long` timestamp. This way, we 
also don't need to call remove inside the if and only have one lookup.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to