Skip to content
This repository was archived by the owner on Jul 21, 2021. It is now read-only.

Hostprovider #91

Merged
merged 2 commits into from
Nov 2, 2015
Merged

Hostprovider #91

merged 2 commits into from
Nov 2, 2015

Conversation

zellyn
Copy link
Contributor

@zellyn zellyn commented Oct 28, 2015

Add variadic options to zk.Connect, and a HostProvider interface based on the Java code. An initial DNSHostprovider is the default, matching Java's implementation.

- 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.
@zellyn
Copy link
Contributor Author

zellyn commented Oct 28, 2015

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

@talbright
Copy link

@zellyn how well has this library been working for you at square?

@samuel
Copy link
Owner

samuel commented Nov 2, 2015

Awesome, this is great work and definitely needed. Thanks for submitting it. The connect options are a good call.

samuel added a commit that referenced this pull request Nov 2, 2015
@samuel samuel merged commit 218e9c8 into samuel:master Nov 2, 2015
@zellyn
Copy link
Contributor Author

zellyn commented Nov 3, 2015

@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. 😄

@zellyn
Copy link
Contributor Author

zellyn commented Nov 3, 2015

@samuel fwiw, I don't think ConnectWithDialer is really used: I couldn't find any non-tests usages in SourceGraph.

@talbright
Copy link

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 💀

@zellyn
Copy link
Contributor Author

zellyn commented Nov 3, 2015

@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

@talbright
Copy link

Thanks for the info and offer, will reach out to you offline. 🍻

@dragonsinth
Copy link

@zellyn Did you ever extend / implement a version of DNSHostProvider that (re-)resolves hostnames periodically / lazily / on error?

@zellyn
Copy link
Contributor Author

zellyn commented Nov 30, 2016

@dragonsinth nope - we have no custom code beyond what's in this repo. Our zookeeper hosts change extremely rarely, if ever.

@dragonsinth
Copy link

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. :)

@zellyn
Copy link
Contributor Author

zellyn commented Nov 30, 2016

I'm guessing the change wouldn't be too difficult, though… :-)

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

Successfully merging this pull request may close these issues.

4 participants