hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jd...@apache.org
Subject hive git commit: HIVE-8326 Using DbTxnManager with concurrency off results in run time error (Alan Gates, reviewed by Eugene Koifman)
Date Tue, 11 Aug 2015 00:23:51 GMT
Repository: hive
Updated Branches:
  refs/heads/branch-1.0 4afa63210 -> a4523cfa7


HIVE-8326 Using DbTxnManager with concurrency off results in run time error (Alan Gates, reviewed
by Eugene Koifman)

git-svn-id: https://svn.apache.org/repos/asf/hive/trunk@1643885 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/a4523cfa
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/a4523cfa
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/a4523cfa

Branch: refs/heads/branch-1.0
Commit: a4523cfa73fa1ed23727cfac9e1a71fec181781c
Parents: 4afa632
Author: Alan Gates <gates@apache.org>
Authored: Mon Dec 8 18:37:18 2014 +0000
Committer: Jason Dere <jdere@hortonworks.com>
Committed: Mon Aug 10 16:34:35 2015 -0700

----------------------------------------------------------------------
 ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java  |  2 ++
 .../apache/hadoop/hive/ql/lockmgr/DbTxnManager.java  |  9 +++++++++
 .../hadoop/hive/ql/lockmgr/TestDbTxnManager.java     | 15 +++++++++++++++
 3 files changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/a4523cfa/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java b/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java
index 292c83c..6dae820 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java
@@ -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"),

http://git-wip-us.apache.org/repos/asf/hive/blob/a4523cfa/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java b/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java
index 46b441a..d11fabd 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.hive.ql.lockmgr;
 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 HiveTxnManagerImpl {
   }
 
   @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 {

http://git-wip-us.apache.org/repos/asf/hive/blob/a4523cfa/ql/src/test/org/apache/hadoop/hive/ql/lockmgr/TestDbTxnManager.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/lockmgr/TestDbTxnManager.java b/ql/src/test/org/apache/hadoop/hive/ql/lockmgr/TestDbTxnManager.java
index 8f593aa..1cd7c32 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/lockmgr/TestDbTxnManager.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/lockmgr/TestDbTxnManager.java
@@ -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