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

fix(proto): correct JoinGroup usage for wider version range #2553

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion consumer_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,24 @@ func (c *consumerGroup) joinGroupRequest(coordinator *Broker, topics []string) (
req.Version = 1
req.RebalanceTimeout = int32(c.config.Consumer.Group.Rebalance.Timeout / time.Millisecond)
}
if c.groupInstanceId != nil {
if c.config.Version.IsAtLeast(V0_11_0_0) {
req.Version = 2
}
if c.config.Version.IsAtLeast(V0_11_0_0) {
req.Version = 2
}
if c.config.Version.IsAtLeast(V2_0_0_0) {
req.Version = 3
}
// XXX: protocol states "Starting from version 4, the client needs to issue a
Copy link
Collaborator

Choose a reason for hiding this comment

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

the if below this comment sets req.Version = 5 so this must work or already be broken?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, although I’ve not personally tested the V5 and static membership stuff so I didn’t want to introduce any breakage until I’d tested it

// second request to join group", so not enabling this until we can
// investigate
/*
if c.config.Version.IsAtLeast(V2_2_0_0) {
req.Version = 4
}
*/
if c.config.Version.IsAtLeast(V2_3_0_0) {
req.Version = 5
req.GroupInstanceId = c.groupInstanceId
}
Expand Down
12 changes: 9 additions & 3 deletions join_group_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,20 @@ func (r *JoinGroupRequest) isValidVersion() bool {

func (r *JoinGroupRequest) requiredVersion() KafkaVersion {
switch r.Version {
case 4, 5:
case 5:
return V2_3_0_0
case 2, 3:
case 4:
return V2_2_0_0
case 3:
return V2_0_0_0
case 2:
return V0_11_0_0
case 1:
return V0_10_1_0
case 0:
return V0_10_0_0
default:
return V0_9_0_0
return V2_3_0_0
}
}

Expand Down
10 changes: 8 additions & 2 deletions join_group_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,20 @@ func (r *JoinGroupResponse) isValidVersion() bool {

func (r *JoinGroupResponse) requiredVersion() KafkaVersion {
switch r.Version {
case 3, 4, 5:
case 5:
return V2_3_0_0
case 4:
return V2_2_0_0
case 3:
return V2_0_0_0
case 2:
return V0_11_0_0
case 1:
return V0_10_1_0
case 0:
return V0_10_0_0
default:
return V0_9_0_0
return V2_3_0_0
}
}

Expand Down
Loading