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

    https://github.com/apache/storm/pull/2090#discussion_r113368417
  
    --- Diff: 
storm-client/src/jvm/org/apache/storm/windowing/TimeTriggerPolicy.java ---
    @@ -109,13 +112,22 @@ private Runnable newTriggerTask() {
             return new Runnable() {
                 @Override
                 public void run() {
    +                // compute the current trigger timestamp based on 
prevTriggerTimestamp,
    +                // since the calculation based on System.currentTimeMillis 
might have a slight drift
    +                long now = System.currentTimeMillis();
    +                long triggerTs = prevTriggerTimestamp == 0 ? now : 
prevTriggerTimestamp + duration;
    +                prevTriggerTimestamp = triggerTs;
    +                if (Math.abs(triggerTs - now) > 1000) {
    --- End diff --
    
    The timing issues are due to the scheduled executor (which uses nanoTime) 
which does not exactly trigger after the duration when measured with 
System.currentTimeMillis. Theres a mismatch of a few ms, which is addressed 
here. In general user code is expected to return before the next trigger. If 
user code takes more time than the trigger interval still we set the next 
trigger timestamp correctly and execute as soon as they return from execute, 
but this should be very rare and users are not expected to do this, so we log 
the warning. I don't think we want multiple concurrent executes (i.e trigger 
execute when they haven't returned from the first execute)


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to