-
Notifications
You must be signed in to change notification settings - Fork 133
Update connection structs to avoid read only warning from server #57
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
base: master
Are you sure you want to change the base?
Conversation
Resolve read-only warning from ZK server on connection
Fix tests after adding readOnly property to connect structs
Are you sure this is the right place where to put this? I think these structs should match the ones in https://github.com/apache/zookeeper/blob/master/zookeeper-jute/src/main/resources/zookeeper.jute#L62 |
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.
left a comment
To be honest you're probably more knowledgeable than me on Zookeeper, if you believe it's not the right thing to do I trust you ! I will try to look at how other ZK clients do this when I have time :) |
I updated the Connection struct so we could add a readOnly flag, to avoid modifying the connRequest struct I append a single byte to the []byte used to authenticate to the zkServer. I was inspired by other clients such as kazoo (python ZK client) tell me what you think of this solution |
Can you share the reference? |
Here's the kazoo client, you can see that a read_only flag is passed at init: The read_only flag is after used to extend the byte array by a single 1 or 0, the byte array is the result of the serialization of the connection request |
Java client appends it as well. Not sure why they didn't extend the jute defintion to add it. |
Hello, It's been more than a month since this PR had any new comments about the change. Do you know if there's any plan to merge it or if there's any improvement I could do ? |
I think what they mean is that it's better to serialize |
Also I suggest you compact the commits into 1, it will be cleaner for the git committing tree. |
Using a ZK server in version 3.4.9 I always have a warning when my app is connecting to it. I believe this is due to this bit of code in the ZK codebase:
ZK now allows the addition of a flag for "ReadOnly" mode, if the client doesn't give this flag it will trigger a warning. If the server is in read-only mode & there's no readOnly field, the connection will we dropped.
The goal of this PR is to avoid triggering this warning, by passing a readOnly always setted to false. I think this can be a first step to handling readOnly ZK server.