Author: vgumashta
Date: Tue Oct 14 04:58:46 2014
New Revision: 1631616

URL: http://svn.apache.org/r1631616
Log:
HIVE-8427: Hive Streaming : secure streaming hangs leading to time outs. 
(Roshan Naik reviewed by Vaibhav Gumashta)

Modified:
    
hive/branches/branch-0.14/hcatalog/streaming/src/java/org/apache/hive/hcatalog/streaming/HiveEndPoint.java

Modified: 
hive/branches/branch-0.14/hcatalog/streaming/src/java/org/apache/hive/hcatalog/streaming/HiveEndPoint.java
URL: 
http://svn.apache.org/viewvc/hive/branches/branch-0.14/hcatalog/streaming/src/java/org/apache/hive/hcatalog/streaming/HiveEndPoint.java?rev=1631616&r1=1631615&r2=1631616&view=diff
==============================================================================
--- 
hive/branches/branch-0.14/hcatalog/streaming/src/java/org/apache/hive/hcatalog/streaming/HiveEndPoint.java
 (original)
+++ 
hive/branches/branch-0.14/hcatalog/streaming/src/java/org/apache/hive/hcatalog/streaming/HiveEndPoint.java
 Tue Oct 14 04:58:46 2014
@@ -240,6 +240,7 @@ public class HiveEndPoint {
     private final HiveEndPoint endPt;
     private final UserGroupInformation ugi;
     private final String username;
+    private final boolean secureMode;
 
     /**
      * @param endPoint end point to connect to
@@ -261,7 +262,8 @@ public class HiveEndPoint {
       if (conf==null) {
         conf = HiveEndPoint.createHiveConf(this.getClass(), 
endPoint.metaStoreUri);
       }
-      this.msClient = getMetaStoreClient(endPoint, conf);
+      this.secureMode = ugi==null ? false : ugi.hasKerberosCredentials();
+      this.msClient = getMetaStoreClient(endPoint, conf, secureMode);
       if (createPart  &&  !endPoint.partitionVals.isEmpty()) {
         createPartitionIfNotExists(endPoint, msClient, conf);
       }
@@ -425,13 +427,15 @@ public class HiveEndPoint {
       return buff.toString();
     }
 
-    private static IMetaStoreClient getMetaStoreClient(HiveEndPoint endPoint, 
HiveConf conf)
+    private static IMetaStoreClient getMetaStoreClient(HiveEndPoint endPoint, 
HiveConf conf, boolean secureMode)
             throws ConnectionError {
 
       if (endPoint.metaStoreUri!= null) {
         conf.setVar(HiveConf.ConfVars.METASTOREURIS, endPoint.metaStoreUri);
       }
-
+      if(secureMode) {
+        conf.setBoolVar(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL,true);
+      }
       try {
         return new HiveMetaStoreClient(conf);
       } catch (MetaException e) {


Reply via email to