hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From the...@apache.org
Subject svn commit: r1538052 - in /hive/trunk: ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
Date Fri, 01 Nov 2013 20:30:29 GMT
Author: thejas
Date: Fri Nov  1 20:30:29 2013
New Revision: 1538052

URL: http://svn.apache.org/r1538052
Log:
HIVE-5715 : HS2 should not "start" a session for every command (Gunther Hagleitner via Thejas
Nair)

Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
    hive/trunk/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java
    hive/trunk/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java?rev=1538052&r1=1538051&r2=1538052&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java Fri Nov  1
20:30:29 2013
@@ -249,6 +249,13 @@ public class SessionState {
   }
 
   /**
+   * Sets the given session state in the thread local var for sessions.
+   */
+  public static void setCurrentSessionState(SessionState session) {
+    tss.set(session);
+  }
+
+  /**
    * set current session to existing session object if a thread is running
    * multiple sessions - it must call this method with the new session object
    * when switching from one session to another.
@@ -256,7 +263,7 @@ public class SessionState {
    */
   public static SessionState start(SessionState startSs) {
 
-    tss.set(startSs);
+    setCurrentSessionState(startSs);
 
     if(startSs.hiveHist == null){
       if (startSs.getConf().getBoolVar(HiveConf.ConfVars.HIVE_SESSION_HISTORY_ENABLED)) {

Modified: hive/trunk/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java
URL: http://svn.apache.org/viewvc/hive/trunk/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java?rev=1538052&r1=1538051&r2=1538052&view=diff
==============================================================================
--- hive/trunk/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java (original)
+++ hive/trunk/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java Fri
Nov  1 20:30:29 2013
@@ -149,7 +149,7 @@ public class SQLOperation extends Execut
         SessionState ss = SessionState.get();
         @Override
         public void run() {
-          SessionState.start(ss);
+          SessionState.setCurrentSessionState(ss);
           try {
             runInternal(getConfigForOperation());
           } catch (HiveSQLException e) {

Modified: hive/trunk/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
URL: http://svn.apache.org/viewvc/hive/trunk/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java?rev=1538052&r1=1538051&r2=1538052&view=diff
==============================================================================
--- hive/trunk/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java (original)
+++ hive/trunk/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java Fri
Nov  1 20:30:29 2013
@@ -89,6 +89,7 @@ public class HiveSessionImpl implements 
     hiveConf.set(ConfVars.HIVESESSIONID.varname,
         sessionHandle.getHandleIdentifier().toString());
     sessionState = new SessionState(hiveConf);
+    SessionState.start(sessionState);
   }
 
   public SessionManager getSessionManager() {
@@ -108,7 +109,9 @@ public class HiveSessionImpl implements 
   }
 
   protected synchronized void acquire() throws HiveSQLException {
-    SessionState.start(sessionState);
+    // need to make sure that the this connections session state is
+    // stored in the thread local for sessions.
+    SessionState.setCurrentSessionState(sessionState);
   }
 
   protected synchronized void release() {
@@ -312,7 +315,7 @@ public class HiveSessionImpl implements 
     opHandleSet.add(opHandle);
     return opHandle;
     } catch (HiveSQLException e) {
-      operationManager.closeOperation(opHandle); 
+      operationManager.closeOperation(opHandle);
       throw e;
     } finally {
       release();



Mime
View raw message