-
Notifications
You must be signed in to change notification settings - Fork 14.8k
KAFKA-19827: Call ack commit callback at end of waiting calls #20758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
apoorvmittal10
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, minor nit comment.
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumerImpl.java
Outdated
Show resolved
Hide resolved
ShivsundarR
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. LGTM!
…#20758) The acknowledgement commit callback in the share consumer gets called on the application thread at the start of the poll, commitSync and commitAsync methods. Specifically in the peculiar case of using the callback together with commitSync, the acknowledgement callback for the committed records is called at the start of the next eligible call, even though the information is already known at the end of the commitSync's execution. The results are correct already, but the timing could be improved in some situations. Reviewers: Apoorv Mittal <apoorvmittal10@gmail.com>, Shivsundar R <shr@confluent.io>
| try { | ||
| handleCompletedAcknowledgements(false); | ||
| } catch (Throwable t) { | ||
| log.warn("Exception thrown in acknowledgement commit callback", t); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this change make testShareGroupMaxSizeConfigExceeded become flaky.
The following code will fix this issue but seem to violate the comments.
// Handle any acknowledgements which completed while we were waiting, but do not throw
// the exception because the fetched records would then not be returned to the caller
try {
handleCompletedAcknowledgements(false);
} catch (GroupMaxSizeReachedException e) {
log.warn("Exception thrown in acknowledgement commit callback", e);
throw e;
} catch (Throwable t) {
log.warn("Exception thrown in acknowledgement commit callback", t);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TaiJuWu thanks for this find. The flaky behaviour and its root cause have already been logged in https://issues.apache.org/jira/browse/KAFKA-19840
…#20758) The acknowledgement commit callback in the share consumer gets called on the application thread at the start of the poll, commitSync and commitAsync methods. Specifically in the peculiar case of using the callback together with commitSync, the acknowledgement callback for the committed records is called at the start of the next eligible call, even though the information is already known at the end of the commitSync's execution. The results are correct already, but the timing could be improved in some situations. Reviewers: Apoorv Mittal <apoorvmittal10@gmail.com>, Shivsundar R <shr@confluent.io>
The acknowledgement commit callback in the share consumer gets called on
the application thread at the start of the poll, commitSync and
commitAsync methods. Specifically in the peculiar case of using the
callback together with commitSync, the acknowledgement callback for the
committed records is called at the start of the next eligible call, even
though the information is already known at the end of the commitSync's
execution. The results are correct already, but the timing could be
improved in some situations.
Reviewers: Apoorv Mittal apoorvmittal10@gmail.com, Shivsundar R
shr@confluent.io