-
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
consuming: avoid setting cursors to nil on LeaveGroup
The client previously supported reassigning topics to consume / groups at runtime with dedicated AssignPartitions and an AssignGroup method. These have long since been removed. The code used to "unset" the prior consumer before allowing a new consumer. We now only unset when leaving a group. Unsetting a code previously nil'd out the cursors in all sources, so that new assignments would not add duplicate cursors. The logic was greatly simplified when transitioning to assigning only in NewClient, and now cursors are only ever added from the original assignments. However, some logic around this was likely lost, and we were left with a bug. The bug involves three things, in order: 1) LeaveGroup 2) the cluster moves a partition from one broker to another 3) a metadata refresh occurs This metadata refresh will attempt to migrate the cursor from one source to another, but the source cursors have been nil'd out. This causes a panic with an out of range index of -1, which is the length of the cursors, minus 1. The easy fix for this is to remove the old code responsible for preventing duplicate cursors around reassignment. We no longer need to worry about this, so removing things fixes the bug and simplifies the code.
- Loading branch information
Showing
3 changed files
with
7 additions
and
51 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