-
Notifications
You must be signed in to change notification settings - Fork 673
Conversation
- Added variadic options to zk.Connect - Initial implementation of HostProvider, and DNSHostProvider, the default HostProvider.
- Added a test for DNSHostProvider that actually fails over the connection. - Wrapped access to the connection's current server in a mutex.
This has been running for two or three weeks now here at Square. The main goal for us was to make zookeeper able to try all hosts for a given DNS name, rather than just the first. cc: @bwester |
@zellyn how well has this library been working for you at square? |
Awesome, this is great work and definitely needed. Thanks for submitting it. The connect options are a good call. |
@talbright Fine so far, although tbh I haven't tracked how many consumers have redeployed their apps since I made the change… Still, it's a pretty straightforward change, with pretty good tests: I don't think there's much to worry about. 😄 |
@samuel fwiw, I don't think ConnectWithDialer is really used: I couldn't find any non-tests usages in SourceGraph. |
I was more curious of your overall experience with go-zookeeper, as we are considering using it for one of our projects (we already have Zookeeper with Clojure clients). If you happen to know of an example of leadership detection in go-zeekeeper that would be awesome. Apologies for hijacking the PR discussion 💀 |
@talbright I'm zellyn@{twitter,gmail.com,squareup.com,etc.} if you want to chat offline. More info on our zookeeper experience from Josh Humphries, my manager: https://groups.google.com/d/msg/mechanical-sympathy/GmyKrZn2Zus/AgBGJZ-eBwAJ |
Thanks for the info and offer, will reach out to you offline. 🍻 |
@zellyn Did you ever extend / implement a version of DNSHostProvider that (re-)resolves hostnames periodically / lazily / on error? |
@dragonsinth nope - we have no custom code beyond what's in this repo. Our zookeeper hosts change extremely rarely, if ever. |
Thanks for the info. Not a huge issue for us either, but we run on Google Compute Engine and recently I had to avoid doing full machine destroy/creates on our ZK nodes after finding out the hard way in staging that none of our clients will try to re-resolve hostnames when the IPs change. :) |
I'm guessing the change wouldn't be too difficult, though… :-) |
Add variadic options to zk.Connect, and a
HostProvider
interface based on the Java code. An initialDNSHostprovider
is the default, matching Java's implementation.