You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by th...@apache.org on 2014/10/28 00:46:05 UTC

svn commit: r1634743 - /hive/branches/branch-0.14/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java

Author: thejas
Date: Mon Oct 27 23:46:05 2014
New Revision: 1634743

URL: http://svn.apache.org/r1634743
Log:
HIVE-8320 : Error in MetaException(message:Got exception: org.apache.thrift.transport.TTransportException java.net.SocketTimeoutException: Read timed out) (Gavin Kim via Thejas Nair)

Modified:
    hive/branches/branch-0.14/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java

Modified: hive/branches/branch-0.14/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java?rev=1634743&r1=1634742&r2=1634743&view=diff
==============================================================================
--- hive/branches/branch-0.14/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java (original)
+++ hive/branches/branch-0.14/service/src/java/org/apache/hive/service/cli/session/HiveSessionImpl.java Mon Oct 27 23:46:05 2014
@@ -35,12 +35,13 @@ import org.apache.hadoop.hive.common.cli
 import org.apache.hadoop.hive.common.cli.IHiveFileProcessor;
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
-import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;
 import org.apache.hadoop.hive.metastore.IMetaStoreClient;
 import org.apache.hadoop.hive.metastore.api.MetaException;
 import org.apache.hadoop.hive.ql.exec.FetchFormatter;
 import org.apache.hadoop.hive.ql.exec.ListSinkOperator;
 import org.apache.hadoop.hive.ql.history.HiveHistory;
+import org.apache.hadoop.hive.ql.metadata.Hive;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.ql.processors.SetProcessor;
 import org.apache.hadoop.hive.ql.session.SessionState;
 import org.apache.hive.common.util.HiveVersionInfo;
@@ -80,7 +81,6 @@ public class HiveSessionImpl implements 
 
   private SessionManager sessionManager;
   private OperationManager operationManager;
-  private IMetaStoreClient metastoreClient = null;
   private final Set<OperationHandle> opHandleSet = new HashSet<OperationHandle>();
   private boolean isOperationLogEnabled;
   private File sessionLogDir;
@@ -315,14 +315,13 @@ public class HiveSessionImpl implements 
 
   @Override
   public IMetaStoreClient getMetaStoreClient() throws HiveSQLException {
-    if (metastoreClient == null) {
-      try {
-        metastoreClient = new HiveMetaStoreClient(getHiveConf());
-      } catch (MetaException e) {
-        throw new HiveSQLException(e);
-      }
+    try {
+      return Hive.get(getHiveConf()).getMSC();
+    } catch (HiveException e) {
+      throw new HiveSQLException("Failed to get metastore connection", e);
+    } catch (MetaException e) {
+      throw new HiveSQLException("Failed to get metastore connection", e);
     }
-    return metastoreClient;
   }
 
   @Override
@@ -538,14 +537,6 @@ public class HiveSessionImpl implements 
   public void close() throws HiveSQLException {
     try {
       acquire(true);
-      /**
-       * For metadata operations like getTables(), getColumns() etc,
-       * the session allocates a private metastore handler which should be
-       * closed at the end of the session
-       */
-      if (metastoreClient != null) {
-        metastoreClient.close();
-      }
       // Iterate through the opHandles and close their operations
       for (OperationHandle opHandle : opHandleSet) {
         operationManager.closeOperation(opHandle);