[ https://issues.apache.org/jira/browse/KAFKA-8924?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17089214#comment-17089214 ]
Matthias J. Sax commented on KAFKA-8924: ---------------------------------------- {quote}there is no sensible default grace period {quote} This is of course subjective, but I would be personally fine with a default of zero. Even if not very common, there are use-cases for which data is actually ordered (in fact, each time when one uses wall clock time); thus, I don't consider it "crazy" to use a default of zero. Furthermore, for simple demos and when people start to build their first apps, it seem desirable to have a few mandatory parameters as possible to make it easier to get started? I see your argument that for a real production use case, one might want to set a custom grace-period with high probability and thus, I could be convinced to make it mandatory. It's just a slight preference of mine to use a default of zero. What I like most about the proposal is, that we could just fix it in 2.7. We should have thought about this earlier and should have fix it in the same release `suppress()` was introduces. Well, better a little delayed than even more delayed (ie, to 3.0). It would be great to get a KIP for this and get it into 2.7, release. > Default grace period (-1) of TimeWindows causes suppress to emit events after > 24h > --------------------------------------------------------------------------------- > > Key: KAFKA-8924 > URL: https://issues.apache.org/jira/browse/KAFKA-8924 > Project: Kafka > Issue Type: Improvement > Components: streams > Affects Versions: 2.3.0 > Reporter: Michał > Assignee: Michał > Priority: Major > Labels: needs-kip > > h2. Problem > The default creation of TimeWindows, like > {code} > TimeWindows.of(ofMillis(xxx)) > {code} > calls an internal constructor > {code} > return new TimeWindows(sizeMs, sizeMs, -1, DEFAULT_RETENTION_MS); > {code} > And the *-1* parameter is the default grace period which I think is here for > backward compatibility > {code} > @SuppressWarnings("deprecation") // continuing to support > Windows#maintainMs/segmentInterval in fallback mode > @Override > public long gracePeriodMs() { > // NOTE: in the future, when we remove maintainMs, > // we should default the grace period to 24h to maintain the default > behavior, > // or we can default to (24h - size) if you want to be super accurate. > return graceMs != -1 ? graceMs : maintainMs() - size(); > } > {code} > The problem is that if you use a TimeWindows with gracePeriod of *-1* > together with suppress *untilWindowCloses*, it never emits an event. > You can check the Suppress tests > (SuppressScenarioTest.shouldSupportFinalResultsForTimeWindows), where > [~vvcephei] was (maybe) aware of that and all the scenarios specify the > gracePeriod. > I will add a test without it on my branch and it will fail. > The test: > https://github.com/atais/kafka/commit/221a04dc40d636ffe93a0ad95dfc6bcad653f4db > > h2. Now what can be done > One easy fix would be to change the default value to 0, which works fine for > me in my project, however, I am not aware of the impact it would have done > due to the changes in the *gracePeriodMs* method mentioned before. -- This message was sent by Atlassian Jira (v8.3.4#803005)