hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1535039 - in /hive/trunk: metastore/src/test/org/apache/hadoop/hive/metastore/TestMetastoreVersion.java ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
Date Wed, 23 Oct 2013 14:49:50 GMT
Author: hashutosh
Date: Wed Oct 23 14:49:50 2013
New Revision: 1535039

URL: http://svn.apache.org/r1535039
Log:
HIVE-5403 : Move loading of filesystem, ugi, metastore client to hive session (Vikram Dixit
via Ashutosh Chauhan)

Modified:
    hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetastoreVersion.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java

Modified: hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetastoreVersion.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetastoreVersion.java?rev=1535039&r1=1535038&r2=1535039&view=diff
==============================================================================
--- hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetastoreVersion.java
(original)
+++ hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/TestMetastoreVersion.java
Wed Oct 23 14:49:50 2013
@@ -86,12 +86,13 @@ public class TestMetastoreVersion extend
     assertFalse(hiveConf.getBoolVar(HiveConf.ConfVars.METASTORE_AUTO_CREATE_SCHEMA));
     assertTrue(hiveConf.getBoolVar(HiveConf.ConfVars.METASTORE_FIXED_DATASTORE));
 
-    SessionState.start(new CliSessionState(hiveConf));
-    driver = new Driver(hiveConf);
-    // driver execution should fail since the schema didn't get created
-    CommandProcessorResponse proc = driver.run("show tables");
-    assertFalse(proc.getResponseCode() == 0);
-   }
+    // session creation should fail since the schema didn't get created
+    try {
+      SessionState.start(new CliSessionState(hiveConf));
+    } catch (RuntimeException re) {
+      assertTrue(re.getCause().getCause() instanceof MetaException);
+    }
+  }
 
   /***
    * Test that with no verification, hive populates the schema and version correctly

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java?rev=1535039&r1=1535038&r2=1535039&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java Wed Oct 23 14:49:50
2013
@@ -2405,6 +2405,15 @@ private void constructOneLBLocationMap(F
         HiveMetaStoreClient.class.getName());
   }
 
+  /*
+   * This api just sets up a metastore client. This is used for
+   * pre-launching the metastore client so as to reduce latency
+   * within a single session.
+   */
+  public void setupMSC() throws MetaException {
+    getMSC();
+  }
+
   /**
    *
    * @return the metastore client for the current thread

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=1535039&r1=1535038&r2=1535039&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 Wed Oct 23
14:49:50 2013
@@ -33,6 +33,8 @@ import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 
+import javax.security.auth.login.LoginException;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
@@ -42,18 +44,21 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
+import org.apache.hadoop.hive.metastore.api.MetaException;
 import org.apache.hadoop.hive.ql.MapRedStats;
 import org.apache.hadoop.hive.ql.exec.Utilities;
 import org.apache.hadoop.hive.ql.history.HiveHistory;
 import org.apache.hadoop.hive.ql.history.HiveHistoryImpl;
 import org.apache.hadoop.hive.ql.history.HiveHistoryProxyHandler;
 import org.apache.hadoop.hive.ql.log.PerfLogger;
+import org.apache.hadoop.hive.ql.metadata.Hive;
 import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.ql.metadata.HiveUtils;
 import org.apache.hadoop.hive.ql.plan.HiveOperation;
 import org.apache.hadoop.hive.ql.security.HiveAuthenticationProvider;
 import org.apache.hadoop.hive.ql.security.authorization.HiveAuthorizationProvider;
 import org.apache.hadoop.hive.ql.util.DosToUnix;
+import org.apache.hadoop.hive.shims.ShimLoader;
 import org.apache.hadoop.util.ReflectionUtils;
 
 /**
@@ -274,6 +279,26 @@ public class SessionState {
       }
     }
 
+    // Get the following out of the way when you start the session these take a
+    // while and should be done when we start up.
+    try {
+      Hive.get(startSs.conf).setupMSC();
+      ShimLoader.getHadoopShims().getUGIForConf(startSs.conf);
+      FileSystem.get(startSs.conf);
+    } catch (IOException e) {
+      // required for the FileSystem.get
+      throw new RuntimeException(e);
+    } catch (LoginException e) {
+      // required for the getUGIForConf
+      throw new RuntimeException(e);
+    } catch (HiveException e) {
+      // required for Hive.get(HiveConf)
+      throw new RuntimeException(e);
+    } catch (MetaException e) {
+      // required for setupMSC()
+      throw new RuntimeException(e);
+    }
+    
     try {
       startSs.authenticator = HiveUtils.getAuthenticator(
           startSs.getConf(),HiveConf.ConfVars.HIVE_AUTHENTICATOR_MANAGER);



Mime
View raw message