Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Where should the code live in? Should it live with operators, state backends, or both? We may also need something in operators or state backends (e.g. operators/StreamingRuntimeContext/KeyedStateStore) to have access to TimerService

    We may need to experiment and prototype before finalizing this decision.

  2. How to distinguish TTL timers from user timers so that

    they don't interfere with each other?
    we

    user timers are always invoked before TTL timers?

    Upon discussion, we believe that the user timer should always be invoked first. We need a good strategy to ensure that

    the TTL timers do not interfere with user-configured timers, specifically, what happens if a user configures a timer

    , when a user timer and a TTL timer are configured for the same time

    as a Ttl timer? Upon discussion

    ,

    we believe that the

    user

    -configured

    timer

    should

    is always

    be invoked we distinguish user and TTL timers?

    triggered first.

    But how can 

    Currently, timer service does not support timer tags

    ,

    . We have two kinds of timers now and we

    may

    need

    to find

    a better

    of achieving the purpose, either adding support for timer tags or some other ways

    way of maintaining both of them. 

    Option1: We can add a tag for each timer to InternalTimer

    Option2: let InternalTimerService maintains user timers and TTL timers separately, by adding to it the following new APIs:

    Code Block
    languagejava
    public void registerTtlProcessingTimeTimer(N namespace, long time);
    
    
    public void registerTtlEventTimeTimer(N namespace, long time);

     And implementation classes of InternalTimerService should add two new sets of timers,  e.g. processingTtlTimeTimersQueue and eventTtlTimeTimersQueue for HeapInternalTimerService. Upon onProcessingTime() and advanceWatermark(), they will first iterate through ProcessingTtlTimeTimer and EventTtlTimeTimer before iterating the ProcessingTimeTimers and EventTimeTimer.

    The biggest advantage, compared to option 1, is that it doesn't impact existing timer-related checkpoint/savepoint and migrations.

 

Test Plan

Normal unit, integration, and end-to-end tests

...