Did anybody happen to take a quick look by any chance? I don't want to push this too hard, because I know it's a time consuming topic to think about, but this is a blocker in 3.5 which has been hanging around for a while and any feedback would be extremely helpful to close it quickly.
Thanks, Andor On Mon, Feb 19, 2018 at 12:18 PM, Andor Molnar <[email protected]> wrote: > Hi all, > > We need more eyes and brains on the following PR: > > https://github.com/apache/zookeeper/pull/451 > > I added a comment few days ago about the way we currently do DNS name > resolution in this class and a suggestion on how we could simplify things a > little bit. We talked about it with Abe Fine, but we're a little bit unsure > and cannot get a conclusion. It would be extremely handy to get more > feedback from you. > > To add some colour to it, let me elaborate on the situation here: > > In general, the task that StaticHostProvider does is to get a list of > potentially unresolved InetSocketAddress objects, resolve them and iterate > over the resolved objects by calling next() method. > > *Option #1 (current logic)* > - Resolve addresses with getAllByName() which returns a list of IP > addresses associated with the address. > - Cache all these IP's, shuffle them and iterate over. > - If client is unable to connect to an IP, remove all IPs from the list > which the original servername was resolved to and re-resolve it. > > *Option #2 (getByName())* > - Resolve address with getByName() instead which returns only the first IP > address of the name, > - Do not cache IPs, > - Shuffle the *names* and resolve with getByName() *every time* when > next() is called, > - JDK's built-in caching will prevent name servers from being flooded and > will do the re-resolution automatically when cache expires, > - Names with multiple IPs will be handled by DNS servers which (if > configured properly) return IPs in different order - this is called DNS > Round Robin -, so getByName() will return different IP on each call. > > *Options #3* > - There's a small problem with option#2: if DNS server is not configured > properly and handles the round-robin case in a way that it always return > the IP list in the same order, getByName() will never return the next ip, > - In order to overcome that, use getAllByName() instead, shuffle the list > and return the first IP. > > All feedback if much appreciated. > > Thanks, > Andor > > > >
