You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by sa...@apache.org on 2016/11/16 15:59:21 UTC

phoenix git commit: CSVBulkLoadToolIT failing consistently because transaction service client init fails

Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 ccc58a524 -> e0c2b0348


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

Branch: refs/heads/4.x-HBase-0.98
Commit: e0c2b0348664fa8ad4f469e0792e052454d57b30
Parents: ccc58a5
Author: Samarth <sa...@salesforce.com>
Authored: Wed Nov 16 07:59:10 2016 -0800
Committer: Samarth <sa...@salesforce.com>
Committed: Wed Nov 16 07:59:10 2016 -0800

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e0c2b034/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/e0c2b034/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 ff0b6aa..c8f5996 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
@@ -25,7 +25,6 @@ import java.sql.DatabaseMetaData;
 import java.sql.DriverManager;
 import java.sql.ResultSet;
 import java.sql.SQLException;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
 
@@ -37,8 +36,6 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
-import org.apache.hadoop.hbase.util.Addressing;
-import org.apache.hadoop.hbase.zookeeper.ZKConfig;
 import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
 import org.apache.phoenix.iterate.ResultIterator;
 import org.apache.phoenix.jdbc.PhoenixConnection;
@@ -347,38 +344,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);