Skip to content
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 protocol/offsetcommit/offsetcommit.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type RequestPartition struct {
PartitionIndex int32 `kafka:"min=v0,max=v7"`
CommittedOffset int64 `kafka:"min=v0,max=v7"`
CommitTimestamp int64 `kafka:"min=v1,max=v1"`
CommittedLeaderEpoch int32 `kafka:"min=v5,max=v7"`
CommittedLeaderEpoch int32 `kafka:"min=v6,max=v7"`
CommittedMetadata string `kafka:"min=v0,max=v7,nullable"`
}

Expand Down
46 changes: 35 additions & 11 deletions protocol/offsetcommit/offsetcommit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,30 +93,54 @@ func TestOffsetCommitRequest(t *testing.T) {
})
}

// Version 5 added:
// RequestTopic.RequestPartition.CommitedLeaderEpoc
// Version 5 removed:
// RetentionTimeMs
// Fields are the same through version 6.
for _, version := range []int16{5, 6} {
for _, version := range []int16{5} {
prototest.TestRequest(t, version, &offsetcommit.Request{
GroupID: "group-3",
GenerationID: 1,
MemberID: "member-3",
Topics: []offsetcommit.RequestTopic{
{
Name: "topic-3",
Partitions: []offsetcommit.RequestPartition{
{
PartitionIndex: 0,
CommittedOffset: 1,
CommittedMetadata: "meta-3-0",
},
{
PartitionIndex: 1,
CommittedOffset: 2,
CommittedMetadata: "meta-3-1",
},
},
},
},
})
}

// Version 6 added:
// RequestTopic.RequestPartition.CommittedLeaderEpoch
for _, version := range []int16{6} {
prototest.TestRequest(t, version, &offsetcommit.Request{
GroupID: "group-4",
GenerationID: 1,
MemberID: "member-4",
Topics: []offsetcommit.RequestTopic{
{
Name: "topic-4",
Partitions: []offsetcommit.RequestPartition{
{
PartitionIndex: 0,
CommittedOffset: 1,
CommittedMetadata: "meta-3-0",
CommittedMetadata: "meta-4-0",
CommittedLeaderEpoch: 10,
},
{
PartitionIndex: 1,
CommittedOffset: 2,
CommittedMetadata: "meta-3-1",
CommittedMetadata: "meta-4-1",
CommittedLeaderEpoch: 11,
},
},
Expand All @@ -129,24 +153,24 @@ func TestOffsetCommitRequest(t *testing.T) {
// GroupInstanceID
for _, version := range []int16{7} {
prototest.TestRequest(t, version, &offsetcommit.Request{
GroupID: "group-4",
GroupID: "group-5",
GenerationID: 1,
MemberID: "member-4",
GroupInstanceID: "instance-4",
MemberID: "member-5",
GroupInstanceID: "instance-5",
Topics: []offsetcommit.RequestTopic{
{
Name: "topic-4",
Partitions: []offsetcommit.RequestPartition{
{
PartitionIndex: 0,
CommittedOffset: 1,
CommittedMetadata: "meta-4-0",
CommittedMetadata: "meta-5-0",
CommittedLeaderEpoch: 10,
},
{
PartitionIndex: 1,
CommittedOffset: 2,
CommittedMetadata: "meta-4-1",
CommittedMetadata: "meta-5-1",
CommittedLeaderEpoch: 11,
},
},
Expand Down