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): use full range of SyncGroupRequest #2565

Merged
merged 1 commit into from
Aug 7, 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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
- id: conventional-commit-msg-validation
name: commit message conventional validation
language: pygrep
entry: '^(breaking|build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w `])+([\s\S]*)'
entry: '^(?:fixup! )?(breaking|build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w `])+([\s\S]*)'
args: [--multiline, --negate]
stages: [commit-msg]
- id: commit-msg-needs-to-be-signed-off
Expand Down
11 changes: 9 additions & 2 deletions consumer_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,12 +507,19 @@ func (c *consumerGroup) syncGroupRequest(
GenerationId: generationID,
}

// Versions 1 and 2 are the same as version 0.
if c.config.Version.IsAtLeast(V0_11_0_0) {
req.Version = 1
}
if c.config.Version.IsAtLeast(V2_0_0_0) {
req.Version = 2
}
// Starting from version 3, we add a new field called groupInstanceId to indicate member identity across restarts.
if c.config.Version.IsAtLeast(V2_3_0_0) {
req.Version = 3
}
if c.groupInstanceId != nil {
req.GroupInstanceId = c.groupInstanceId
}

for memberID, topics := range plan {
assignment := &ConsumerGroupMemberAssignment{Topics: topics}
userDataBytes, err := strategy.AssignmentData(memberID, topics, generationID)
Expand Down
2 changes: 2 additions & 0 deletions mockresponses.go
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,9 @@ func NewMockSyncGroupResponse(t TestReporter) *MockSyncGroupResponse {
}

func (m *MockSyncGroupResponse) For(reqBody versionedDecoder) encoderWithHeader {
req := reqBody.(*SyncGroupRequest)
resp := &SyncGroupResponse{
Version: req.version(),
Err: m.Err,
MemberAssignment: m.MemberAssignment,
}
Expand Down
4 changes: 3 additions & 1 deletion sync_group_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,10 @@ func (r *SyncGroupRequest) requiredVersion() KafkaVersion {
return V2_0_0_0
case 1:
return V0_11_0_0
default:
case 0:
return V0_9_0_0
default:
return V2_3_0_0
}
}

Expand Down
4 changes: 3 additions & 1 deletion sync_group_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ func (r *SyncGroupResponse) requiredVersion() KafkaVersion {
return V2_0_0_0
case 1:
return V0_11_0_0
default:
case 0:
return V0_9_0_0
default:
return V2_3_0_0
}
}

Expand Down
Loading