incubator-hcatalog-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1162286 - in /incubator/hcatalog/branches/branch-0.2: CHANGES.txt src/java/org/apache/hcatalog/mapreduce/HCatOutputFormat.java src/java/org/apache/hcatalog/mapreduce/InitializeInput.java src/java/org/apache/hcatalog/pig/PigHCatUtil.java
Date Fri, 26 Aug 2011 23:21:14 GMT
Author: gates
Date: Fri Aug 26 23:21:13 2011
New Revision: 1162286

URL: http://svn.apache.org/viewvc?rev=1162286&view=rev
Log:
HCATALOG-53: HCatLoader, HCatStorer, HCatInputFormat, and HCatOutputFormat assume Hadoop running
in secure mode

Modified:
    incubator/hcatalog/branches/branch-0.2/CHANGES.txt
    incubator/hcatalog/branches/branch-0.2/src/java/org/apache/hcatalog/mapreduce/HCatOutputFormat.java
    incubator/hcatalog/branches/branch-0.2/src/java/org/apache/hcatalog/mapreduce/InitializeInput.java
    incubator/hcatalog/branches/branch-0.2/src/java/org/apache/hcatalog/pig/PigHCatUtil.java

Modified: incubator/hcatalog/branches/branch-0.2/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.2/CHANGES.txt?rev=1162286&r1=1162285&r2=1162286&view=diff
==============================================================================
--- incubator/hcatalog/branches/branch-0.2/CHANGES.txt (original)
+++ incubator/hcatalog/branches/branch-0.2/CHANGES.txt Fri Aug 26 23:21:13 2011
@@ -49,6 +49,8 @@ Release 0.2.0 - Unreleased
   OPTIMIZATIONS
 
   BUG FIXES
+    HCAT-53. HCatLoader, HCatStorer, HCatInputFormat, and HCatOutputFormat assume Hadoop
running in secure mode (ashutoshc via gates)
+
     HCAT-57. Remove usage of deprecated methods (hashutosh)
    
     HCAT-59. Assimilate new changes in listener interface (hashutosh)

Modified: incubator/hcatalog/branches/branch-0.2/src/java/org/apache/hcatalog/mapreduce/HCatOutputFormat.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.2/src/java/org/apache/hcatalog/mapreduce/HCatOutputFormat.java?rev=1162286&r1=1162285&r2=1162286&view=diff
==============================================================================
--- incubator/hcatalog/branches/branch-0.2/src/java/org/apache/hcatalog/mapreduce/HCatOutputFormat.java
(original)
+++ incubator/hcatalog/branches/branch-0.2/src/java/org/apache/hcatalog/mapreduce/HCatOutputFormat.java
Fri Aug 26 23:21:13 2011
@@ -36,6 +36,7 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.PathFilter;
 import org.apache.hadoop.fs.permission.FsPermission;
 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.api.FieldSchema;
 import org.apache.hadoop.hive.metastore.api.MetaException;
@@ -417,11 +418,17 @@ public class HCatOutputFormat extends HC
       if( url != null ) {
         //User specified a thrift url
 
-        hiveConf.setBoolean(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL.varname, true);
-        hiveConf.set(HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL.varname, conf.get(HCatConstants.HCAT_METASTORE_PRINCIPAL));
-
         hiveConf.set("hive.metastore.local", "false");
-        hiveConf.set(HiveConf.ConfVars.METASTOREURIS.varname, url);
+        hiveConf.set(ConfVars.METASTOREURIS.varname, url);
+        
+        String kerberosPrincipal = conf.get(HCatConstants.HCAT_METASTORE_PRINCIPAL);
+        if (kerberosPrincipal == null){
+            kerberosPrincipal = conf.get(ConfVars.METASTORE_KERBEROS_PRINCIPAL.varname);
+        }
+        if (kerberosPrincipal != null){
+            hiveConf.setBoolean(ConfVars.METASTORE_USE_THRIFT_SASL.varname, true);
+            hiveConf.set(ConfVars.METASTORE_KERBEROS_PRINCIPAL.varname, kerberosPrincipal);
+        }        
         if(conf.get(HCatConstants.HCAT_KEY_TOKEN_SIGNATURE) != null) {
           hiveConf.set("hive.metastore.token.signature", conf.get(HCatConstants.HCAT_KEY_TOKEN_SIGNATURE));
         }

Modified: incubator/hcatalog/branches/branch-0.2/src/java/org/apache/hcatalog/mapreduce/InitializeInput.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.2/src/java/org/apache/hcatalog/mapreduce/InitializeInput.java?rev=1162286&r1=1162285&r2=1162286&view=diff
==============================================================================
--- incubator/hcatalog/branches/branch-0.2/src/java/org/apache/hcatalog/mapreduce/InitializeInput.java
(original)
+++ incubator/hcatalog/branches/branch-0.2/src/java/org/apache/hcatalog/mapreduce/InitializeInput.java
Fri Aug 26 23:21:13 2011
@@ -51,15 +51,17 @@ public class InitializeInput {
   private static final HiveConf hiveConf = new HiveConf(HCatInputFormat.class);
 
   private static HiveMetaStoreClient createHiveMetaClient(Configuration conf, HCatTableInfo
inputInfo) throws Exception {
-    if (inputInfo.getServerUri() != null){
-
-      hiveConf.setBoolean(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL.varname, true);
-      hiveConf.set(HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL.varname,
-          inputInfo.getServerKerberosPrincipal());
 
+	if (inputInfo.getServerUri() != null){
       hiveConf.set("hive.metastore.local", "false");
       hiveConf.set(HiveConf.ConfVars.METASTOREURIS.varname, inputInfo.getServerUri());
     }
+    
+    String kerberosPrincipal = inputInfo.getServerKerberosPrincipal();
+    if(kerberosPrincipal != null){
+      hiveConf.setBoolean(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL.varname, true);
+      hiveConf.set(HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL.varname, kerberosPrincipal);
+    }
 
     return new HiveMetaStoreClient(hiveConf,null);
   }

Modified: incubator/hcatalog/branches/branch-0.2/src/java/org/apache/hcatalog/pig/PigHCatUtil.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.2/src/java/org/apache/hcatalog/pig/PigHCatUtil.java?rev=1162286&r1=1162285&r2=1162286&view=diff
==============================================================================
--- incubator/hcatalog/branches/branch-0.2/src/java/org/apache/hcatalog/pig/PigHCatUtil.java
(original)
+++ incubator/hcatalog/branches/branch-0.2/src/java/org/apache/hcatalog/pig/PigHCatUtil.java
Fri Aug 26 23:21:13 2011
@@ -98,13 +98,15 @@ public class PigHCatUtil {
     HiveConf hiveConf = new HiveConf(clazz);
 
     if (serverUri != null){
-
-      hiveConf.setBoolVar(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL, true);
-      hiveConf.setVar(HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL, serverKerberosPrincipal);
-
       hiveConf.set("hive.metastore.local", "false");
       hiveConf.setVar(HiveConf.ConfVars.METASTOREURIS, serverUri.trim());
     }
+    
+    if (serverKerberosPrincipal != null){
+      hiveConf.setBoolVar(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL, true);
+      hiveConf.setVar(HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL, serverKerberosPrincipal);
   	
+    }
+    
     try {
       client = new HiveMetaStoreClient(hiveConf,null);
     } catch (Exception e){



Mime
View raw message