hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prasan...@apache.org
Subject svn commit: r1671631 [3/3] - in /hive/branches/llap: ./ common/src/java/org/apache/hadoop/hive/conf/ hcatalog/hcatalog-pig-adapter/src/test/java/org/apache/hive/hcatalog/pig/ hcatalog/webhcat/svr/src/main/config/ metastore/src/java/org/apache/hadoop/hi...
Date Mon, 06 Apr 2015 18:32:23 GMT
Modified: hive/branches/llap/service/src/java/org/apache/hive/service/cli/session/HiveSession.java
URL: http://svn.apache.org/viewvc/hive/branches/llap/service/src/java/org/apache/hive/service/cli/session/HiveSession.java?rev=1671631&r1=1671630&r2=1671631&view=diff
==============================================================================
--- hive/branches/llap/service/src/java/org/apache/hive/service/cli/session/HiveSession.java
(original)
+++ hive/branches/llap/service/src/java/org/apache/hive/service/cli/session/HiveSession.java
Mon Apr  6 18:32:21 2015
@@ -151,4 +151,6 @@ public interface HiveSession extends Hiv
       throws HiveSQLException;
 
   void closeExpiredOperations();
+
+  long getNoOperationTime();
 }

Modified: hive/branches/llap/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
URL: http://svn.apache.org/viewvc/hive/branches/llap/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java?rev=1671631&r1=1671630&r2=1671631&view=diff
==============================================================================
--- hive/branches/llap/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
(original)
+++ hive/branches/llap/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
Mon Apr  6 18:32:21 2015
@@ -91,6 +91,7 @@ public class HiveSessionImpl implements
   private boolean isOperationLogEnabled;
   private File sessionLogDir;
   private volatile long lastAccessTime;
+  private volatile long lastIdleTime;
 
   public HiveSessionImpl(TProtocolVersion protocol, String username, String password,
       HiveConf serverhiveConf, String ipAddress) {
@@ -147,6 +148,7 @@ public class HiveSessionImpl implements
       configureSession(sessionConfMap);
     }
     lastAccessTime = System.currentTimeMillis();
+    lastIdleTime = lastAccessTime;
   }
 
   /**
@@ -295,6 +297,11 @@ public class HiveSessionImpl implements
     if (userAccess) {
       lastAccessTime = System.currentTimeMillis();
     }
+    if (opHandleSet.isEmpty()) {
+      lastIdleTime = System.currentTimeMillis();
+    } else {
+      lastIdleTime = 0;
+    }
   }
 
   @Override
@@ -605,6 +612,11 @@ public class HiveSessionImpl implements
     }
   }
 
+  @Override
+  public long getNoOperationTime() {
+    return lastIdleTime > 0 ? System.currentTimeMillis() - lastIdleTime : 0;
+  }
+
   private void closeTimedOutOperations(List<Operation> operations) {
     acquire(false);
     try {

Modified: hive/branches/llap/service/src/java/org/apache/hive/service/cli/session/SessionManager.java
URL: http://svn.apache.org/viewvc/hive/branches/llap/service/src/java/org/apache/hive/service/cli/session/SessionManager.java?rev=1671631&r1=1671630&r2=1671631&view=diff
==============================================================================
--- hive/branches/llap/service/src/java/org/apache/hive/service/cli/session/SessionManager.java
(original)
+++ hive/branches/llap/service/src/java/org/apache/hive/service/cli/session/SessionManager.java
Mon Apr  6 18:32:21 2015
@@ -62,6 +62,7 @@ public class SessionManager extends Comp
 
   private long checkInterval;
   private long sessionTimeout;
+  private boolean checkOperation;
 
   private volatile boolean shutdown;
   // The HiveServer2 instance running this service
@@ -107,6 +108,8 @@ public class SessionManager extends Comp
         hiveConf, ConfVars.HIVE_SERVER2_SESSION_CHECK_INTERVAL, TimeUnit.MILLISECONDS);
     sessionTimeout = HiveConf.getTimeVar(
         hiveConf, ConfVars.HIVE_SERVER2_IDLE_SESSION_TIMEOUT, TimeUnit.MILLISECONDS);
+    checkOperation = HiveConf.getBoolVar(hiveConf,
+        ConfVars.HIVE_SERVER2_IDLE_SESSION_CHECK_OPERATION);
   }
 
   private void initOperationLogRootDir() {
@@ -155,7 +158,8 @@ public class SessionManager extends Comp
         for (sleepInterval(interval); !shutdown; sleepInterval(interval)) {
           long current = System.currentTimeMillis();
           for (HiveSession session : new ArrayList<HiveSession>(handleToSession.values()))
{
-            if (sessionTimeout > 0 && session.getLastAccessTime() + sessionTimeout
<= current) {
+            if (sessionTimeout > 0 && session.getLastAccessTime() + sessionTimeout
<= current
+                && (!checkOperation || session.getNoOperationTime() > sessionTimeout))
{
               SessionHandle handle = session.getSessionHandle();
               LOG.warn("Session " + handle + " is Timed-out (last access : " +
                   new Date(session.getLastAccessTime()) + ") and will be closed");

Modified: hive/branches/llap/service/src/java/org/apache/hive/service/server/HiveServer2.java
URL: http://svn.apache.org/viewvc/hive/branches/llap/service/src/java/org/apache/hive/service/server/HiveServer2.java?rev=1671631&r1=1671630&r2=1671631&view=diff
==============================================================================
--- hive/branches/llap/service/src/java/org/apache/hive/service/server/HiveServer2.java (original)
+++ hive/branches/llap/service/src/java/org/apache/hive/service/server/HiveServer2.java Mon
Apr  6 18:32:21 2015
@@ -297,6 +297,18 @@ public class HiveServer2 extends Composi
     }
   }
 
+  private static void startPauseMonitor(HiveConf conf) throws Exception {
+    try {
+      Class.forName("org.apache.hadoop.util.JvmPauseMonitor");
+      org.apache.hadoop.util.JvmPauseMonitor pauseMonitor =
+        new org.apache.hadoop.util.JvmPauseMonitor(conf);
+      pauseMonitor.start();
+    } catch (Throwable t) {
+      LOG.warn("Could not initiate the JvmPauseMonitor thread." +
+               " GCs and Pauses may not be warned upon.", t);
+    }
+  }
+
   private static void startHiveServer2() throws Throwable {
     long attempts = 0, maxAttempts = 1;
     while (true) {
@@ -308,6 +320,7 @@ public class HiveServer2 extends Composi
         server = new HiveServer2();
         server.init(hiveConf);
         server.start();
+        startPauseMonitor(hiveConf);
         // If we're supporting dynamic service discovery, we'll add the service uri for this
         // HiveServer2 instance to Zookeeper as a znode.
         if (hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_SUPPORT_DYNAMIC_SERVICE_DISCOVERY))
{



Mime
View raw message