-
Notifications
You must be signed in to change notification settings - Fork 779
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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?
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// version 1 supscription data without OwnedPartitionsy | |
// version 1 subscription data without OwnedPartitions |
} | ||
|
||
type subscriptionBackwardsCompat struct { | ||
Version int16 `kafka:"min=v0,max=v1"` |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
Potential fix for #1156