-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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-17455: fix stuck producer when throttling or retrying #17527
Merged
mjsax
merged 8 commits into
apache:trunk
from
coltmcnealy-lh:kafka-17455/fix-stuck-producer
Jan 9, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d0956ba
KAFKA-17455: fixes stuck producer by polling again after pollDelayMs …
coltmcnealy-lh d1d7d94
clarifies comments
coltmcnealy-lh 54507da
attempts to add test
coltmcnealy-lh 292d1ef
Adds a test but my changes to MockClient.java broke all sorts of stuff
coltmcnealy-lh 1bc3443
test that passes on my branch and fails on trunk
coltmcnealy-lh 3da6309
addresses PR feedback: rename MockClient#setAdvanceTimeDuringPoll to …
coltmcnealy-lh e56a563
feedback from pull request
coltmcnealy-lh 344a519
final PR feedback
coltmcnealy-lh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 noticed when developing my test that repeated calls to
poll()
withtimeoutMs == 10
never resulted intime.milliseconds()
advancing, so the fictitiousNode
in my test never became ready (time never advanced past the throttled time). That's why I made this change; however, it broke all sorts of things.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 guess most test don't expect that time advanced "automatically"... It think we need to remove this.
I think there two possibilities: start a background thread in your test before you call
runOnce()
and let the background thread advance mockTime (maybe too complex?), or, make theMockTime
object more advanced and add some "auto-time-advance" feature, ie, each timemilliseconds()
is called, advance time by 1ms (or some other value passed into MockTime -- only your test would enable this feature.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 Matthias. I did something somewhat inspired by your comment. Ready for review.
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.
Should work, too, but why don't you just create
new MockTime(1L)
and use the already existing "auto-tick" feature?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.
@mjsax the problem is that the following test still passes on
trunk
usingnew MockTime(1L)
. However, the test that I have in the PR as it stands passes on my branch but fails on trunk: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 suppose that the test passes with
new MockTime(1L)
because the newtime
is not used by theclient
. The client must be created after thetime
is set. Would it work? I would also prefer this over adding the sleep in the mock client.