Repository: phoenix
Updated Branches:
  refs/heads/4.8-HBase-1.2 7f74817f9 -> d34792f1c


CSVBulkLoadToolIT failing consistently because transaction service client init 
fails


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/d34792f1
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d34792f1
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d34792f1

Branch: refs/heads/4.8-HBase-1.2
Commit: d34792f1c6a759823d6ba87b75bb1d79e096ece3
Parents: 7f74817
Author: Samarth <[email protected]>
Authored: Wed Nov 16 08:22:07 2016 -0800
Committer: Samarth <[email protected]>
Committed: Wed Nov 16 08:22:07 2016 -0800

----------------------------------------------------------------------
 .../java/org/apache/phoenix/util/QueryUtil.java | 36 +++-----------------
 1 file changed, 5 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d34792f1/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
index 6d8e00d..dc41352 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
@@ -346,38 +346,12 @@ public final class QueryUtil {
     }
     public static String getConnectionUrl(Properties props, Configuration 
conf, String principal)
             throws ClassNotFoundException, SQLException {
-        // TODO: props is ignored!
         // read the hbase properties from the configuration
-        String server = ZKConfig.getZKQuorumServersString(conf);
-        // could be a comma-separated list
-        String[] rawServers = server.split(",");
-        List<String> servers = new ArrayList<String>(rawServers.length);
-        int port = -1;
-        for (String serverPort : rawServers) {
-            try {
-                server = Addressing.parseHostname(serverPort);
-                int specifiedPort = Addressing.parsePort(serverPort);
-                // there was a previously specified port and it doesn't match 
this server
-                if (port > 0 && specifiedPort != port) {
-                    throw new IllegalStateException("Phoenix/HBase only 
supports connecting to a " +
-                            "single zookeeper client port. Specify servers 
only as host names in " +
-                            "HBase configuration");
-                }
-                // set the port to the specified port
-                port = specifiedPort;
-                servers.add(server);
-            } catch (IllegalArgumentException e) {
-            }
-        }
-        // port wasn't set, shouldn't ever happen from HBase, but just in case
-        if (port == -1) {
-            port = conf.getInt(QueryServices.ZOOKEEPER_PORT_ATTRIB, -1);
-            if (port == -1) {
-                // TODO: fall back to the default in 
HConstants#DEFAULT_ZOOKEPER_CLIENT_PORT
-                throw new RuntimeException("Client zk port was not set!");
-            }
-        }
-        server = Joiner.on(',').join(servers);
+        int port = conf.getInt(HConstants.ZOOKEEPER_CLIENT_PORT, 
HConstants.DEFAULT_ZOOKEPER_CLIENT_PORT);
+        // Build the ZK quorum server string with "server:clientport" list, 
separated by ','
+        final String[] servers =
+                conf.getStrings(HConstants.ZOOKEEPER_QUORUM, 
HConstants.LOCALHOST);
+        String server = Joiner.on(',').join(servers);
         String znodeParent = conf.get(HConstants.ZOOKEEPER_ZNODE_PARENT,
                 HConstants.DEFAULT_ZOOKEEPER_ZNODE_PARENT);
         String url = getUrl(server, port, znodeParent, principal);

Reply via email to