You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by we...@apache.org on 2016/07/25 16:30:31 UTC

hive git commit: HIVE-14311 : No need to schedule Heartbeat task if the query doesn't require locks (Wei Zheng, reviewed by Eugene Koifman)

Repository: hive
Updated Branches:
  refs/heads/master 9938d45da -> 85a8c32f5


HIVE-14311 : No need to schedule Heartbeat task if the query doesn't require locks (Wei Zheng, reviewed by Eugene Koifman)


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

Branch: refs/heads/master
Commit: 85a8c32f5f1114a4314b2afcb3688e56dcd5432d
Parents: 9938d45
Author: Wei Zheng <we...@apache.org>
Authored: Mon Jul 25 09:32:05 2016 -0700
Committer: Wei Zheng <we...@apache.org>
Committed: Mon Jul 25 09:32:05 2016 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java     | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/85a8c32f/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 7b0369d..02c17b5 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
@@ -354,8 +354,10 @@ public class DbTxnManager extends HiveTxnManagerImpl {
    */
   @VisibleForTesting
   void acquireLocksWithHeartbeatDelay(QueryPlan plan, Context ctx, String username, long delay) throws LockException {
-    acquireLocks(plan, ctx, username, true);
-    ctx.setHeartbeater(startHeartbeat(delay));
+    LockState ls = acquireLocks(plan, ctx, username, true);
+    if (ls != null) { // If there's no lock, we don't need to do heartbeat
+      ctx.setHeartbeater(startHeartbeat(delay));
+    }
   }
 
 
@@ -438,6 +440,9 @@ public class DbTxnManager extends HiveTxnManagerImpl {
     }
     if(!isTxnOpen() && locks.isEmpty()) {
       // No locks, no txn, we outta here.
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("No need to send heartbeat as there is no transaction and no locks.");
+      }
       return;
     }
     for (HiveLock lock : locks) {