Skip to content
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

KAFKA-18056: Fixed bug in handling commitAsync responses #17909

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

ShivsundarR
Copy link
Contributor

What
There was a bug in handling the ShareAcknowledgeResponse for commitAsync(). Currently after we receive a response, we send out a background event to the application thread to update the acknowledgement commit callbacks for EVERY TopicIdPartition.
The map that was sent was not cleared after sending the event. This meant we ended up sending responses for partitions that were already sent in the previous event. So there will be duplicate calls to the callback.

The PR fixes the bug and adds a unit test for the same.

Copy link
Collaborator

@AndrewJSchofield AndrewJSchofield left a 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.

@@ -421,6 +421,10 @@ public void onComplete(Map<TopicIdPartition, Set<Long>> offsetsMap, Exception ex
Set<Long> mergedOffsets = new HashSet<>();
mergedOffsets.addAll(oldOffsets);
mergedOffsets.addAll(newOffsets);
if (mergedOffsets.size() < (oldOffsets.size() + newOffsets.size())) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is quite a dangerous thing to leave in here. In principle, a test could rely upon repeated delivery of a record (timeout for example) which could actually call the callback twice. I'd remove this because I predict it will be the source of a flaky test later on.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right makes sense, sometimes genuinely we can have the callback called twice. I have removed it now, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants