You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2016/11/15 03:31:29 UTC

[06/13] hive git commit: HIVE-15002 : HiveSessionImpl#executeStatementInternal may leave locks in an inconsistent state (Zoltan Haindrich via Thejas Nair)

HIVE-15002 : HiveSessionImpl#executeStatementInternal may leave locks in an inconsistent state (Zoltan Haindrich via Thejas Nair)


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

Branch: refs/heads/hive-14535
Commit: 876ecdc6e7297664afa943366785aa1339fdb096
Parents: ed8cc8a
Author: Zoltan Haindrich <ki...@rxd.hu>
Authored: Fri Nov 4 17:36:05 2016 -0700
Committer: Thejas Nair <th...@hortonworks.com>
Committed: Fri Nov 4 17:37:00 2016 -0700

----------------------------------------------------------------------
 .../hive/service/cli/session/HiveSessionImpl.java    | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/876ecdc6/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java b/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
index 8051f47..8f5e92e 100644
--- a/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
+++ b/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
@@ -496,11 +496,12 @@ public class HiveSessionImpl implements HiveSession {
       Map<String, String> confOverlay, boolean runAsync, long queryTimeout) throws HiveSQLException {
     acquire(true, true);
 
-    OperationManager operationManager = getOperationManager();
-    ExecuteStatementOperation operation = operationManager.newExecuteStatementOperation(
-        getSession(), statement, confOverlay, runAsync, queryTimeout);
-    OperationHandle opHandle = operation.getHandle();
+    ExecuteStatementOperation operation = null;
+    OperationHandle opHandle = null;
     try {
+      operation = getOperationManager().newExecuteStatementOperation(getSession(), statement,
+          confOverlay, runAsync, queryTimeout);
+      opHandle = operation.getHandle();
       operation.run();
       addOpHandle(opHandle);
       return opHandle;
@@ -508,10 +509,12 @@ public class HiveSessionImpl implements HiveSession {
       // Refering to SQLOperation.java, there is no chance that a HiveSQLException throws and the
       // async background operation submits to thread pool successfully at the same time. So, Cleanup
       // opHandle directly when got HiveSQLException
-      operationManager.closeOperation(opHandle);
+      if (opHandle != null) {
+        getOperationManager().closeOperation(opHandle);
+      }
       throw e;
     } finally {
-      if (operation.getBackgroundHandle() == null) {
+      if (operation == null || operation.getBackgroundHandle() == null) {
         release(true, true); // Not async, or wasn't submitted for some reason (failure, etc.)
       } else {
         releaseBeforeOpLock(true); // Release, but keep the lock (if present).