-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 FindCoordinatorResponse.encode to allow nil Coordinator #1050
Conversation
df01655
to
20e9b58
Compare
find_coordinator_response.go
Outdated
return nil | ||
} | ||
pe.putInt32(0) | ||
if f.Version >= 1 { |
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.
This is not matched by the fact that we hard-code passing version 0 into Coordinator.encode
?
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.
Hm. We are currently sharing the same decode/encode method for Metadata*
and FindCoordinator*
but since version 1 of the MetadataResponse
they are not the equal.
Metadata
has rack whereas FindCoordinator
does not — so actually 69-73 can be dropped
It would be nice if you could add a test for this case. |
Good catch. Maybe we should line up the test and encoding of a nil coordinator with the actual response where private static final Node NO_NODE = new Node(-1, "", -1); |
Sorry if I was unclear about my comment re: the shared The short of it was that the Sending a followup patch so let's continue there |
Good catch, thank you @buyology. |
FindCoordinatorResponse.encode
function panics ifCoordinator
isnil
, so I fixed that. Besides I added MockFindCoordinatorResponse to use in tests.