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

work around incorrect v1 metadata #1172

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

rhansen2
Copy link
Collaborator

Potential fix for #1156

Copy link
Contributor

@petedannemann petedannemann left a comment

Choose a reason for hiding this comment

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

Could you do a functional test to verify if this fixes the issue we want it to?

protocol/consumer/consumer.go Outdated Show resolved Hide resolved
joingroup.go Outdated Show resolved Hide resolved
joingroup_test.go Outdated Show resolved Hide resolved
protocol/consumer/consumer_test.go Outdated Show resolved Hide resolved
protocol/consumer/consumer_test.go Outdated Show resolved Hide resolved
func (s *subscriptionBackwardsCompat) FromBytes(b []byte) error {
// This type is only intended to maintain backwards compatibility with
// this library and support other clients in the wild sending
// version 1 supscription data without OwnedPartitionsy
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// version 1 supscription data without OwnedPartitionsy
// version 1 subscription data without OwnedPartitions

}

type subscriptionBackwardsCompat struct {
Version int16 `kafka:"min=v0,max=v1"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Style wise I'm on the fence of adding an addition type for this vs. handling this in Subscriptions's FromBytes method. What do you think?

}
version := readInt16(b[0:2])
err := protocol.Unmarshal(b, version, s)
if err != nil && version >= 1 && errors.Is(err, io.ErrUnexpectedEOF) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think we could either move the comment about backwards capability above here or make these checks in the if statement a separate function like isBackwardsCompatible? I had a bit of a hard time understanding it the way the code is structured now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants