-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
consuming: fix logic race, simplify some logic
If metadata stopped a consumer session concurrent with a consumer session needing to be stopped for a topic assignment, then the reload offsets could be pushed into loading with the next session. If the second assignment was to filter some offsets (say due to group rebalance), then it would miss filtering what was stopped in the metadata request. By ensuring that we have one worker when starting a new session, we allow work to be done within that session before it can be stopped again. The race here was extremely unlikely because not only is it rare for these two events to occur at once, it would be even more rare for the go scheduler to not favor just continuing the one goroutine that was executing some logic. Finally, with a closure, we move the session stopping and partition whatnot logic into the metadata code where the variables are initialized. This keeps the code closer together so that it is easier to keep everything in your head at once.
- Loading branch information
Showing
3 changed files
with
51 additions
and
29 deletions.
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