[ 
https://issues.apache.org/jira/browse/KAFKA-6323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16300584#comment-16300584
 ] 

Matthias J. Sax commented on KAFKA-6323:
----------------------------------------

I don't think so -- we only align the schedule, but not the timestamp we pass 
into the `punctuate()` call itself. Ie, atm we would do the following In 
practice, I would assume that punctuation are actually never called at the 
actual scheduled time, but always a couple of milliseconds late, taking this 
into account, without alignment we even shift without a long GC pause:
{noformat}
interval 10000

old: 
scheduled punctuation: 10000   20003   30005   40010   50012
calling punctuation:   10003   20005   30010   40012
new:
scheduled punctuation: 10000   20000   30000   40000   50000
calling punctuation:   10003   20002   30005   40002
{noformat}

Thus, the delays to the schedule do not add up over time with the alignment. 
Note, that the timestamp we pass into the punctuation call is never the 
timestamp of the schedule but `NOW`. For example, in the first example, we 
might be able to call punctuate at 40002 but we scheduled at 40010 and thus 
cannot call before the schedule.


> punctuate with WALL_CLOCK_TIME triggered immediately
> ----------------------------------------------------
>
>                 Key: KAFKA-6323
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6323
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams
>    Affects Versions: 1.0.0
>            Reporter: Frederic Arno
>            Assignee: Frederic Arno
>             Fix For: 1.1.0, 1.0.1
>
>
> When working on a custom Processor from which I am scheduling a punctuation 
> using WALL_CLOCK_TIME. I've noticed that whatever the punctuation interval I 
> set, a call to my Punctuator is always triggered immediately.
> Having a quick look at kafka-streams' code, I could find that all 
> PunctuationSchedule's timestamps are matched against the current time in 
> order to decide whether or not to trigger the punctuator 
> (org.apache.kafka.streams.processor.internals.PunctuationQueue#mayPunctuate). 
> However, I've only seen code that initializes PunctuationSchedule's timestamp 
> to 0, which I guess is what is causing an immediate punctuation.
> At least when using WALL_CLOCK_TIME, shouldn't the PunctuationSchedule's 
> timestamp be initialized to current time + interval?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to