You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2020/01/21 23:57:49 UTC

[hive] branch master updated: HIVE-22745 : Config option to turn off read locks (Slim Bouguerra via Gopal V)

This is an automated email from the ASF dual-hosted git repository.

hashutosh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new d62df02  HIVE-22745 : Config option to turn off read locks (Slim Bouguerra via Gopal V)
d62df02 is described below

commit d62df021ac5a4e535a887459b9ef5cf7e25f9c9e
Author: Slim Bouguerra <bs...@apache.org>
AuthorDate: Tue Jan 21 15:57:15 2020 -0800

    HIVE-22745 : Config option to turn off read locks (Slim Bouguerra via Gopal V)
    
    Signed-off-by: Ashutosh Chauhan <ha...@apache.org>
---
 common/src/java/org/apache/hadoop/hive/conf/HiveConf.java | 2 ++
 ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java   | 7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
index fc53ed3..b79515f 100644
--- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
+++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
@@ -2644,6 +2644,8 @@ public class HiveConf extends Configuration {
         "In nonstrict mode, for non-ACID resources, INSERT will only acquire shared lock, which\n" +
         "allows two concurrent writes to the same partition but still lets lock manager prevent\n" +
         "DROP TABLE etc. when the table is being written to"),
+    HIVE_TXN_READ_LOCKS("hive.txn.read.locks", true,
+        "flag to turn off the strict read lock when set to false"),
     TXN_OVERWRITE_X_LOCK("hive.txn.xlock.iow", true,
         "Ensures commands with OVERWRITE (such as INSERT OVERWRITE) acquire Exclusive locks for\n" +
             "transactional tables.  This ensures that inserts (w/o overwrite) running concurrently\n" +
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java b/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
index 14d1884..0ff9e1a 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
@@ -2843,8 +2843,13 @@ public class AcidUtils {
       HiveConf conf) {
     List<LockComponent> lockComponents = new ArrayList<>();
     // For each source to read, get a shared lock
+    boolean skipReadLock = !conf.getBoolVar(ConfVars.HIVE_TXN_READ_LOCKS);
     for (ReadEntity input : inputs) {
-      if (input.isDummy() || !input.needsLock() || input.isUpdateOrDelete() || !AcidUtils.needsLock(input)) {
+      if (input.isDummy()
+          || !input.needsLock()
+          || input.isUpdateOrDelete()
+          || !AcidUtils.needsLock(input)
+          || skipReadLock) {
         // We don't want to acquire read locks during update or delete as we'll be acquiring write
         // locks instead. Also, there's no need to lock temp tables since they're session wide
         continue;