hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1643885 - in /hive/trunk/ql/src: java/org/apache/hadoop/hive/ql/ErrorMsg.java java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java test/org/apache/hadoop/hive/ql/lockmgr/TestDbTxnManager.java
Date Mon, 08 Dec 2014 18:37:18 GMT
Author: gates
Date: Mon Dec  8 18:37:18 2014
New Revision: 1643885

URL: http://svn.apache.org/r1643885
Log:
HIVE-8326 Using DbTxnManager with concurrency off results in run time error (Alan Gates, reviewed
by Eugene Koifman)

Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java
    hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/lockmgr/TestDbTxnManager.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java?rev=1643885&r1=1643884&r2=1643885&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java Mon Dec  8 18:37:18 2014
@@ -388,6 +388,8 @@ public enum ErrorMsg {
   TXN_NO_SUCH_TRANSACTION(10262, "No record of transaction could be found, " +
       "may have timed out"),
   TXN_ABORTED(10263, "Transaction manager has aborted the transaction."),
+  DBTXNMGR_REQUIRES_CONCURRENCY(10264,
+      "To use DbTxnManager you must set hive.support.concurrency=true"),
 
   LOCK_NO_SUCH_LOCK(10270, "No record of lock could be found, " +
       "may have timed out"),

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java?rev=1643885&r1=1643884&r2=1643885&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java Mon Dec  8
18:37:18 2014
@@ -20,6 +20,7 @@ package org.apache.hadoop.hive.ql.lockmg
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hive.common.ValidTxnList;
+import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;
 import org.apache.hadoop.hive.metastore.IMetaStoreClient;
 import org.apache.hadoop.hive.metastore.LockComponentBuilder;
@@ -55,6 +56,14 @@ public class DbTxnManager extends HiveTx
   }
 
   @Override
+  void setHiveConf(HiveConf conf) {
+    super.setHiveConf(conf);
+    if (!conf.getBoolVar(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY)) {
+      throw new RuntimeException(ErrorMsg.DBTXNMGR_REQUIRES_CONCURRENCY.getMsg());
+    }
+  }
+
+  @Override
   public long openTxn(String user) throws LockException {
     init();
     try {

Modified: hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/lockmgr/TestDbTxnManager.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/lockmgr/TestDbTxnManager.java?rev=1643885&r1=1643884&r2=1643885&view=diff
==============================================================================
--- hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/lockmgr/TestDbTxnManager.java (original)
+++ hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/lockmgr/TestDbTxnManager.java Mon Dec
 8 18:37:18 2014
@@ -275,6 +275,21 @@ public class TestDbTxnManager {
     Assert.assertNull(locks);
   }
 
+  @Test
+  public void concurrencyFalse() throws Exception {
+    HiveConf badConf = new HiveConf();
+    badConf.setVar(HiveConf.ConfVars.HIVE_TXN_MANAGER,
+        "org.apache.hadoop.hive.ql.lockmgr.DbTxnManager");
+    badConf.setBoolVar(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
+    boolean sawException = false;
+    try {
+      TxnManagerFactory.getTxnManagerFactory().getTxnManager(badConf);
+    } catch (RuntimeException e) {
+      sawException = true;
+    }
+    Assert.assertTrue(sawException);
+  }
+
 
   @Before
   public void setUp() throws Exception {



Mime
View raw message