Return-Path: X-Original-To: apmail-phoenix-commits-archive@minotaur.apache.org Delivered-To: apmail-phoenix-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3BCF518986 for ; Wed, 11 Nov 2015 07:47:21 +0000 (UTC) Received: (qmail 35256 invoked by uid 500); 11 Nov 2015 07:47:21 -0000 Delivered-To: apmail-phoenix-commits-archive@phoenix.apache.org Received: (qmail 35215 invoked by uid 500); 11 Nov 2015 07:47:21 -0000 Mailing-List: contact commits-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list commits@phoenix.apache.org Received: (qmail 35206 invoked by uid 99); 11 Nov 2015 07:47:21 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Nov 2015 07:47:21 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0BC7BE0280; Wed, 11 Nov 2015 07:47:21 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jamestaylor@apache.org To: commits@phoenix.apache.org Message-Id: <66bb063600fb4fe1bfe9ff9c155d85b1@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: phoenix git commit: PHOENIX-2399 Server is sometimes unable to find Phoenix driver Date: Wed, 11 Nov 2015 07:47:21 +0000 (UTC) Repository: phoenix Updated Branches: refs/heads/master 645f74a46 -> b07f669a8 PHOENIX-2399 Server is sometimes unable to find Phoenix driver Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/b07f669a Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/b07f669a Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/b07f669a Branch: refs/heads/master Commit: b07f669a84681c63bf6dba1ed99c3a0f408bd585 Parents: 645f74a Author: James Taylor Authored: Tue Nov 10 23:47:11 2015 -0800 Committer: James Taylor Committed: Tue Nov 10 23:47:11 2015 -0800 ---------------------------------------------------------------------- .../phoenix/mapreduce/CsvBulkLoadToolIT.java | 18 ++++++++---------- .../org/apache/phoenix/mapreduce/IndexToolIT.java | 5 +++++ .../java/org/apache/phoenix/util/QueryUtil.java | 3 +++ 3 files changed, 16 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/b07f669a/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/CsvBulkLoadToolIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/CsvBulkLoadToolIT.java b/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/CsvBulkLoadToolIT.java index a787113..0e74d7b 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/CsvBulkLoadToolIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/CsvBulkLoadToolIT.java @@ -17,7 +17,6 @@ */ package org.apache.phoenix.mapreduce; -import static org.apache.phoenix.query.BaseTest.initAndRegisterDriver; import static org.apache.phoenix.query.BaseTest.setUpConfigForMiniCluster; import static org.apache.phoenix.query.QueryServices.DATE_FORMAT_ATTRIB; import static org.junit.Assert.assertArrayEquals; @@ -43,8 +42,6 @@ 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.ReadOnlyProps; -import org.apache.phoenix.util.TestUtil; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -63,16 +60,17 @@ public class CsvBulkLoadToolIT { hbaseTestUtil = new HBaseTestingUtility(); Configuration conf = hbaseTestUtil.getConfiguration(); setUpConfigForMiniCluster(conf); + // Since we're using the real PhoenixDriver in this test, remove the + // extra JDBC argument that causes the test driver to be used. + conf.set(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB, QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS); hbaseTestUtil.startMiniCluster(); hbaseTestUtil.startMiniMapReduceCluster(); - zkQuorum = TestUtil.LOCALHOST + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + hbaseTestUtil.getZkCluster().getClientPort(); - String url = PhoenixRuntime.JDBC_PROTOCOL + - PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum + - PhoenixRuntime.JDBC_PROTOCOL_TERMINATOR + - conf.get(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB, QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS); - initAndRegisterDriver(url, ReadOnlyProps.EMPTY_PROPS); - conn = DriverManager.getConnection(url); + Class.forName(PhoenixDriver.class.getName()); + DriverManager.registerDriver(PhoenixDriver.INSTANCE); + zkQuorum = "localhost:" + hbaseTestUtil.getZkCluster().getClientPort(); + conn = DriverManager.getConnection(PhoenixRuntime.JDBC_PROTOCOL + + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum); } @AfterClass http://git-wip-us.apache.org/repos/asf/phoenix/blob/b07f669a/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/IndexToolIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/IndexToolIT.java b/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/IndexToolIT.java index 30cae36..c88a5f4 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/IndexToolIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/IndexToolIT.java @@ -37,6 +37,8 @@ import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.phoenix.end2end.NeedsOwnMiniClusterTest; import org.apache.phoenix.jdbc.PhoenixDriver; import org.apache.phoenix.mapreduce.index.IndexTool; +import org.apache.phoenix.query.QueryServices; +import org.apache.phoenix.query.QueryServicesOptions; import org.apache.phoenix.util.MetaDataUtil; import org.apache.phoenix.util.PhoenixRuntime; import org.apache.phoenix.util.PropertiesUtil; @@ -63,6 +65,9 @@ public class IndexToolIT { hbaseTestUtil = new HBaseTestingUtility(); Configuration conf = hbaseTestUtil.getConfiguration(); conf.setBoolean("hbase.defaults.for.version.skip", true); + // Since we're using the real PhoenixDriver in this test, remove the + // extra JDBC argument that causes the test driver to be used. + conf.set(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB, QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS); setUpConfigForMiniCluster(conf); hbaseTestUtil.startMiniCluster(); hbaseTestUtil.startMiniMapReduceCluster(); http://git-wip-us.apache.org/repos/asf/phoenix/blob/b07f669a/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 d444644..51c03fd 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 @@ -305,6 +305,9 @@ public final class QueryUtil { throws ClassNotFoundException, SQLException { // TODO: props is ignored! // make sure we load the phoenix driver + // TODO: remove this - it doesn't belong here + // The driver should be loaded outside of this call as we might + // be using the test driver. Class.forName(PhoenixDriver.class.getName()); // read the hbase properties from the configuration