You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ek...@apache.org on 2014/11/01 20:59:02 UTC

svn commit: r1636023 - in /hive/trunk: hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/ shims/common-secure/src/main/java/org/apache/hadoop/hive/shims/

Author: ekoifman
Date: Sat Nov  1 19:59:02 2014
New Revision: 1636023

URL: http://svn.apache.org/r1636023
Log:
HIVE-8685 DDL operations in WebHCat set proxy user to null in unsecure mode (Eugene Koifman, reviewed by Thejas M Nair)

Modified:
    hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/ExecServiceImpl.java
    hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/SecureProxySupport.java
    hive/trunk/shims/common-secure/src/main/java/org/apache/hadoop/hive/shims/HadoopShimsSecure.java

Modified: hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/ExecServiceImpl.java
URL: http://svn.apache.org/viewvc/hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/ExecServiceImpl.java?rev=1636023&r1=1636022&r2=1636023&view=diff
==============================================================================
--- hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/ExecServiceImpl.java (original)
+++ hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/ExecServiceImpl.java Sat Nov  1 19:59:02 2014
@@ -229,15 +229,17 @@ public class ExecServiceImpl implements 
       watchdog.checkException();
     }
     catch (Exception ex) {
-      LOG.error("Command: " + cmd + " failed:", ex);
+      LOG.error("Command: " + cmd + " failed. res=" + res, ex);
     }
     if(watchdog.killedProcess()) {
       String msg = " was terminated due to timeout(" + timeout + "ms).  See " + AppConfig
               .EXEC_TIMEOUT_NAME + " property"; 
-      LOG.warn("Command: " + cmd + msg);
+      LOG.warn("Command: " + cmd + msg + " res=" + res);
       res.stderr += " Command " + msg; 
     }
-
+    if(res.exitcode != 0) {
+      LOG.info("Command: " + cmd + " failed. res=" + res);
+    }
     return res;
   }
 

Modified: hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/SecureProxySupport.java
URL: http://svn.apache.org/viewvc/hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/SecureProxySupport.java?rev=1636023&r1=1636022&r2=1636023&view=diff
==============================================================================
--- hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/SecureProxySupport.java (original)
+++ hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/SecureProxySupport.java Sat Nov  1 19:59:02 2014
@@ -40,7 +40,7 @@ import org.apache.thrift.TException;
 
 /**
  * Helper class to run jobs using Kerberos security.  Always safe to
- * use these methods, it's a noop if security is not enabled.
+ * use these methods, it's a no-op if security is not enabled.
  */
 public class SecureProxySupport {
   private Path tokenPath;
@@ -121,9 +121,9 @@ public class SecureProxySupport {
     if (isEnabled) {
       args.add("-D");
       args.add("hive.metastore.token.signature=" + getHcatServiceStr());
+      args.add("-D");
+      args.add("proxy.user.name=" + user);
     }
-    args.add("-D");
-    args.add("proxy.user.name=" + user);
   }
 
   class TokenWrapper {

Modified: hive/trunk/shims/common-secure/src/main/java/org/apache/hadoop/hive/shims/HadoopShimsSecure.java
URL: http://svn.apache.org/viewvc/hive/trunk/shims/common-secure/src/main/java/org/apache/hadoop/hive/shims/HadoopShimsSecure.java?rev=1636023&r1=1636022&r2=1636023&view=diff
==============================================================================
--- hive/trunk/shims/common-secure/src/main/java/org/apache/hadoop/hive/shims/HadoopShimsSecure.java (original)
+++ hive/trunk/shims/common-secure/src/main/java/org/apache/hadoop/hive/shims/HadoopShimsSecure.java Sat Nov  1 19:59:02 2014
@@ -463,7 +463,7 @@ public abstract class HadoopShimsSecure 
 
   @Override
   public UserGroupInformation getUGIForConf(Configuration conf) throws IOException {
-    String doAs = conf.get("proxy.user.name");
+    String doAs = System.getenv("HADOOP_USER_NAME");
     if(doAs != null && doAs.length() > 0) {
      /*
       * this allows doAs (proxy user) to be passed along across process boundary where