KAFKA-7477: Improve Streams close timeout semantics#5747
KAFKA-7477: Improve Streams close timeout semantics#5747mjsax merged 13 commits intoapache:trunkfrom
Conversation
|
Hello, @vvcephei. Can you take a look? |
|
Tests passed. @mjsax Can you take a look? |
mjsax
left a comment
There was a problem hiding this comment.
Thanks for the PR. We need to preserve existing semantics. I guess, the simplest way will be, to introduce a private synchronized boolean close(final long timeout, final TimeUnit timeUnit, boolean newSemantics) and call it with true/false from new and old close(). The newSemantics flag can be passed into waitOnState() (or we duplicate the old one as waitOnStateBlocking that we only call for newSemantics==false?
If there is another more elegant way, we can do it differently, too. Just an idea.
|
|
||
| private static final String JMX_PREFIX = "kafka.streams"; | ||
| private static final int DEFAULT_CLOSE_TIMEOUT = 0; | ||
| private static final int DEFAULT_CLOSE_TIMEOUT = 30; |
|
We should also add a test |
|
Hello, @mjsax Looks like a didn't understand initial task properly :)
Please, take a look. |
|
Failure unrelated. Retest this, please. |
| while (state != targetState) { | ||
| if (waitMs == 0) { | ||
| if (newSemantics) | ||
| return false; |
There was a problem hiding this comment.
Nit: every conditional needs to have braces (per the code style)
not nit: I find this logic a little difficult to follow. Contrary to what @mjsax suggested, wouldn't it be pretty straightforward to map the old semantics on to the new ones like this:
- negative numbers => 0
- 0 => Long.MAX_VALUE
- all other arguments stay the same
?
Then, the old close method could just transform its arguments and call the new method, with no need to have this "new semantics" flag and an early return in the middle of the loop.
There was a problem hiding this comment.
@vvcephei I like your proposal. Thanks!
Changed PR according to it.
vvcephei
left a comment
There was a problem hiding this comment.
Thanks for the update; this seems easier to follow to me. I had one more question...
mjsax
left a comment
There was a problem hiding this comment.
Thanks for updating the PR. Some more comments.
mjsax
left a comment
There was a problem hiding this comment.
LGTM. Waiting for second +1 before merging.
|
Hello @guozhangwang @bbejeck I've got +1 from @mjsax and need one more :) |
|
LGTM! |
Reviewers: Matthias J. Sax <matthias@confluent.io>, John Roesler <john@confluent.io>, Bill Bejeck <bill@confluent.io>, Guozhang Wang <guozhang@confluent.io>
|
Merged to |
Reviewers: Matthias J. Sax <matthias@confluent.io>, John Roesler <john@confluent.io>, Bill Bejeck <bill@confluent.io>, Guozhang Wang <guozhang@confluent.io>
Second part of KIP-358.
This changes based on previous PR discussion.
Default
closetimeout is30 seconds.Committer Checklist (excluded from commit message)