zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hanm <...@git.apache.org>
Subject [GitHub] zookeeper pull request #534: ZOOKEEPER-2184 Zookeeper Client should re-resol...
Date Fri, 08 Jun 2018 21:33:19 GMT
Github user hanm commented on a diff in the pull request:

    --- Diff: src/java/main/org/apache/zookeeper/client/StaticHostProvider.java ---
    @@ -149,15 +185,12 @@ public StaticHostProvider(Collection<InetSocketAddress> serverAddresses,
          * @param currentHost the host to which this client is currently connected
          * @return true if changing connections is necessary for load-balancing, false otherwise
         public synchronized boolean updateServerList(
                 Collection<InetSocketAddress> serverAddresses,
                 InetSocketAddress currentHost) {
    -        // Resolve server addresses and shuffle them
    -        List<InetSocketAddress> resolvedList = resolveAndShuffle(serverAddresses);
    -        if (resolvedList.isEmpty()) {
    +        List<InetSocketAddress> shuffledList = shuffle(serverAddresses);
    --- End diff --
    I am not sure why we change the `resolveAndShuffle` to `shuffle` here, they are semantically
different (one tries to resolve address, the other does not and only does shuffle.). The `serverAddresses`
passed in this method is unresolved address, and we need it resolved because we rely on the
resolved addresses to compare the old / new server list (in the context of probability rebalancing
clients for dynamic reconfiguration). 
    Without resolving I think the client rebalance logic will be broken. A side note that
all tests still passed probably indicate we don't have a 100% coverage for the logic in our


View raw message