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/4e65d30e
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/4e65d30e
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/4e65d30e

Branch: refs/heads/calcite
Commit: 4e65d30e0c4f578638e3c5f911cde4349ce5e172
Parents: 0f2e972
Author: Samarth <samarth.j...@salesforce.com>
Authored: Wed Nov 16 08:04:16 2016 -0800
Committer: Samarth <samarth.j...@salesforce.com>
Committed: Wed Nov 16 08:04:16 2016 -0800

----------------------------------------------------------------------
 .../phoenix/end2end/CsvBulkLoadToolIT.java      |  7 ++--
 .../java/org/apache/phoenix/util/QueryUtil.java | 36 +++-----------------
 2 files changed, 7 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4e65d30e/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java
index 6aaaeb1..421f328 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java
@@ -41,6 +41,7 @@ import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.util.DateUtil;
 import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
 import org.apache.phoenix.util.TestUtil;
 import org.junit.BeforeClass;
@@ -55,11 +56,7 @@ public class CsvBulkLoadToolIT extends BaseOwnClusterIT {
 
     @BeforeClass
     public static void doSetup() throws Exception {
-        Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(1);
-        serverProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB, 
QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
-        Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(1);
-        clientProps.put(QueryServices.TRANSACTIONS_ENABLED, "true");
-        setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), 
new ReadOnlyProps(clientProps.entrySet().iterator()));
+        setUpTestDriver(ReadOnlyProps.EMPTY_PROPS);
         zkQuorum = TestUtil.LOCALHOST + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR 
+ getUtility().getZkCluster().getClientPort();
         conn = DriverManager.getConnection(getUrl());
     }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4e65d30e/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 58fb151..f348a26 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