Return-Path: X-Original-To: apmail-hive-commits-archive@www.apache.org Delivered-To: apmail-hive-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F2E8E11563 for ; Wed, 30 Jul 2014 00:05:54 +0000 (UTC) Received: (qmail 19992 invoked by uid 500); 30 Jul 2014 00:05:54 -0000 Delivered-To: apmail-hive-commits-archive@hive.apache.org Received: (qmail 19944 invoked by uid 500); 30 Jul 2014 00:05:54 -0000 Mailing-List: contact commits-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hive-dev@hive.apache.org Delivered-To: mailing list commits@hive.apache.org Received: (qmail 19869 invoked by uid 99); 30 Jul 2014 00:05:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jul 2014 00:05:54 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jul 2014 00:05:53 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 0F85F2388A67; Wed, 30 Jul 2014 00:05:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1614523 - in /hive/trunk: hcatalog/streaming/src/test/sit metastore/pom.xml metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java pom.xml Date: Wed, 30 Jul 2014 00:05:32 -0000 To: commits@hive.apache.org From: hashutosh@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140730000533.0F85F2388A67@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: hashutosh Date: Wed Jul 30 00:05:32 2014 New Revision: 1614523 URL: http://svn.apache.org/r1614523 Log: HIVE-7246 : Hive transaction manager hardwires bonecp as the JDBC pooling implementation (Alan Gates via Ashutosh Chauhan) Modified: hive/trunk/hcatalog/streaming/src/test/sit hive/trunk/metastore/pom.xml hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java hive/trunk/pom.xml Modified: hive/trunk/hcatalog/streaming/src/test/sit URL: http://svn.apache.org/viewvc/hive/trunk/hcatalog/streaming/src/test/sit?rev=1614523&r1=1614522&r2=1614523&view=diff ============================================================================== --- hive/trunk/hcatalog/streaming/src/test/sit (original) +++ hive/trunk/hcatalog/streaming/src/test/sit Wed Jul 30 00:05:32 2014 @@ -33,7 +33,7 @@ for jar in ${HIVE_HOME}/hcatalog/share/h CLASSPATH=${CLASSPATH}:$jar done -CLASSPATH=${CLASSPATH}:${HADOOP_HOME}/conf +CLASSPATH=${CLASSPATH}:${HADOOP_HOME}/etc/hadoop CLASSPATH=${CLASSPATH}:${HIVE_HOME}/conf $JAVA_HOME/bin/java -cp ${CLASSPATH} org.apache.hive.hcatalog.streaming.StreamingIntegrationTester $@ Modified: hive/trunk/metastore/pom.xml URL: http://svn.apache.org/viewvc/hive/trunk/metastore/pom.xml?rev=1614523&r1=1614522&r2=1614523&view=diff ============================================================================== --- hive/trunk/metastore/pom.xml (original) +++ hive/trunk/metastore/pom.xml Wed Jul 30 00:05:32 2014 @@ -92,6 +92,16 @@ ${datanucleus-rdbms.version} + commons-pool + commons-pool + ${commons-pool.version} + + + commons-dbcp + commons-dbcp + ${commons-dbcp.version} + + javax.jdo jdo-api ${jdo-api.version} Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java?rev=1614523&r1=1614522&r2=1614523&view=diff ============================================================================== --- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java (original) +++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java Wed Jul 30 00:05:32 2014 @@ -17,17 +17,24 @@ */ package org.apache.hadoop.hive.metastore.txn; -import com.jolbox.bonecp.BoneCP; import com.jolbox.bonecp.BoneCPConfig; +import com.jolbox.bonecp.BoneCPDataSource; +import org.apache.commons.dbcp.ConnectionFactory; +import org.apache.commons.dbcp.DriverManagerConnectionFactory; +import org.apache.commons.dbcp.PoolableConnectionFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.commons.dbcp.PoolingDataSource; +import org.apache.commons.pool.ObjectPool; +import org.apache.commons.pool.impl.GenericObjectPool; import org.apache.hadoop.hive.common.ValidTxnList; import org.apache.hadoop.hive.common.ValidTxnListImpl; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.metastore.api.*; import org.apache.hadoop.util.StringUtils; +import javax.sql.DataSource; import java.sql.*; import java.util.*; @@ -65,9 +72,9 @@ public class TxnHandler { static final private int ALLOWED_REPEATED_DEADLOCKS = 5; static final private Log LOG = LogFactory.getLog(TxnHandler.class.getName()); - static private BoneCP connPool; - private static final Boolean lockLock = new Boolean("true"); // Random object to lock on for the - // lock method + static private DataSource connPool; + private static Boolean lockLock = new Boolean("true"); // Random object to lock on for the lock + // method /** * Number of consecutive deadlocks we have seen @@ -1596,14 +1603,28 @@ public class TxnHandler { String driverUrl = HiveConf.getVar(conf, HiveConf.ConfVars.METASTORECONNECTURLKEY); String user = HiveConf.getVar(conf, HiveConf.ConfVars.METASTORE_CONNECTION_USER_NAME); String passwd = HiveConf.getVar(conf, HiveConf.ConfVars.METASTOREPWD); + String connectionPooler = HiveConf.getVar(conf, + HiveConf.ConfVars.METASTORE_CONNECTION_POOLING_TYPE).toLowerCase(); - BoneCPConfig config = new BoneCPConfig(); - config.setJdbcUrl(driverUrl); - config.setMaxConnectionsPerPartition(10); - config.setPartitionCount(1); - config.setUser(user); - config.setPassword(passwd); - connPool = new BoneCP(config); + if ("bonecp".equals(connectionPooler)) { + BoneCPConfig config = new BoneCPConfig(); + config.setJdbcUrl(driverUrl); + config.setMaxConnectionsPerPartition(10); + config.setPartitionCount(1); + config.setUser(user); + config.setPassword(passwd); + connPool = new BoneCPDataSource(config); + } else if ("dbcp".equals(connectionPooler)) { + ObjectPool objectPool = new GenericObjectPool(); + ConnectionFactory connFactory = new DriverManagerConnectionFactory(driverUrl, user, passwd); + // This doesn't get used, but it's still necessary, see + // http://svn.apache.org/viewvc/commons/proper/dbcp/branches/DBCP_1_4_x_BRANCH/doc/ManualPoolingDataSourceExample.java?view=markup + PoolableConnectionFactory poolConnFactory = + new PoolableConnectionFactory(connFactory, objectPool, null, null, false, true); + connPool = new PoolingDataSource(objectPool); + } else { + throw new RuntimeException("Unknown JDBC connection pooling " + connectionPooler); + } } private static synchronized void buildJumpTable() { Modified: hive/trunk/pom.xml URL: http://svn.apache.org/viewvc/hive/trunk/pom.xml?rev=1614523&r1=1614522&r2=1614523&view=diff ============================================================================== --- hive/trunk/pom.xml (original) +++ hive/trunk/pom.xml Wed Jul 30 00:05:32 2014 @@ -104,6 +104,8 @@ 2.4 3.1 1.1.3 + 1.5.4 + 1.4 10.10.1.1 11.0.2 2.1.6