hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prasan...@apache.org
Subject hive git commit: HIVE-10442: HIVE-10098 broke hadoop-1 build (Yongzhi Chen reviewed by Prasanth Jayachandran)
Date Mon, 27 Apr 2015 21:04:26 GMT
Repository: hive
Updated Branches:
  refs/heads/master fb5b0955c -> 487d6c8aa


HIVE-10442: HIVE-10098 broke hadoop-1 build (Yongzhi Chen reviewed by Prasanth Jayachandran)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/487d6c8a
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/487d6c8a
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/487d6c8a

Branch: refs/heads/master
Commit: 487d6c8aa06c31cbc441da1e3f06b7537777712e
Parents: fb5b095
Author: Prasanth Jayachandran <j.prasanth.j@gmail.com>
Authored: Mon Apr 27 14:04:17 2015 -0700
Committer: Prasanth Jayachandran <j.prasanth.j@gmail.com>
Committed: Mon Apr 27 14:04:17 2015 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hive/ql/exec/SecureCmdDoAs.java    |  5 +----
 .../org/apache/hadoop/hive/shims/Hadoop20SShims.java     |  8 ++++++++
 .../java/org/apache/hadoop/hive/shims/Hadoop23Shims.java |  5 +++++
 .../java/org/apache/hadoop/hive/shims/HadoopShims.java   | 11 +++++++++++
 .../org/apache/hadoop/hive/shims/HadoopShimsSecure.java  |  4 ++++
 5 files changed, 29 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/487d6c8a/ql/src/java/org/apache/hadoop/hive/ql/exec/SecureCmdDoAs.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/SecureCmdDoAs.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/SecureCmdDoAs.java
index 7553abb..974c74e 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/SecureCmdDoAs.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/SecureCmdDoAs.java
@@ -28,7 +28,6 @@ import org.apache.hadoop.hive.ql.metadata.HiveException;
 import org.apache.hadoop.hive.shims.ShimLoader;
 import org.apache.hadoop.security.Credentials;
 import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.security.token.Token;
 
 /**
  * SecureCmdDoAs - Helper class for setting parameters and env necessary for
@@ -46,9 +45,7 @@ public class SecureCmdDoAs {
     String uname = UserGroupInformation.getLoginUser().getShortUserName();
     FileSystem fs = FileSystem.get(conf);
     Credentials cred = new Credentials();
-    // Use method addDelegationTokens instead of getDelegationToken to get all the tokens
including KMS.
-    fs.addDelegationTokens(uname, cred);
-
+    ShimLoader.getHadoopShims().addDelegationTokens(fs, cred, uname);
     tokenFile = File.createTempFile("hive_hadoop_delegation_token", null);
     tokenPath = new Path(tokenFile.toURI());
 

http://git-wip-us.apache.org/repos/asf/hive/blob/487d6c8a/shims/0.20S/src/main/java/org/apache/hadoop/hive/shims/Hadoop20SShims.java
----------------------------------------------------------------------
diff --git a/shims/0.20S/src/main/java/org/apache/hadoop/hive/shims/Hadoop20SShims.java b/shims/0.20S/src/main/java/org/apache/hadoop/hive/shims/Hadoop20SShims.java
index 0727945..6d8166c 100644
--- a/shims/0.20S/src/main/java/org/apache/hadoop/hive/shims/Hadoop20SShims.java
+++ b/shims/0.20S/src/main/java/org/apache/hadoop/hive/shims/Hadoop20SShims.java
@@ -67,7 +67,9 @@ import org.apache.hadoop.mapreduce.OutputFormat;
 import org.apache.hadoop.mapreduce.TaskAttemptContext;
 import org.apache.hadoop.mapreduce.TaskAttemptID;
 import org.apache.hadoop.mapreduce.TaskID;
+import org.apache.hadoop.security.Credentials;
 import org.apache.hadoop.security.KerberosName;
+import org.apache.hadoop.security.token.Token;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.util.Progressable;
 import org.apache.hadoop.util.Tool;
@@ -719,4 +721,10 @@ public class Hadoop20SShims extends HadoopShimsSecure {
       return result;
     }
   }
+
+  @Override
+  public void addDelegationTokens(FileSystem fs, Credentials cred, String uname) throws IOException
{
+    Token<?> fsToken = fs.getDelegationToken(uname);
+    cred.addToken(fsToken.getService(), fsToken);
+  }
 }

http://git-wip-us.apache.org/repos/asf/hive/blob/487d6c8a/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java
----------------------------------------------------------------------
diff --git a/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java b/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java
index 9168fba..d349068 100644
--- a/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java
+++ b/shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java
@@ -88,6 +88,7 @@ import org.apache.hadoop.mapreduce.task.JobContextImpl;
 import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl;
 import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.security.authentication.util.KerberosName;
+import org.apache.hadoop.security.Credentials;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.util.Progressable;
 import org.apache.hadoop.util.Tool;
@@ -1352,4 +1353,8 @@ public class Hadoop23Shims extends HadoopShimsSecure {
     }
     return result;
   }
+  public void addDelegationTokens(FileSystem fs, Credentials cred, String uname) throws IOException
{
+    // Use method addDelegationTokens instead of getDelegationToken to get all the tokens
including KMS.
+    fs.addDelegationTokens(uname, cred);
+  }
 }

http://git-wip-us.apache.org/repos/asf/hive/blob/487d6c8a/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShims.java
----------------------------------------------------------------------
diff --git a/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShims.java b/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShims.java
index 08bab90..5a6bc44 100644
--- a/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShims.java
+++ b/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShims.java
@@ -34,6 +34,7 @@ import java.util.TreeMap;
 import javax.security.auth.login.LoginException;
 
 import com.google.common.annotations.VisibleForTesting;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
@@ -62,6 +63,7 @@ import org.apache.hadoop.mapreduce.OutputFormat;
 import org.apache.hadoop.mapreduce.TaskAttemptContext;
 import org.apache.hadoop.mapreduce.TaskAttemptID;
 import org.apache.hadoop.mapreduce.TaskID;
+import org.apache.hadoop.security.Credentials;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.util.Progressable;
 
@@ -717,4 +719,13 @@ public interface HadoopShims {
    *         will be set to old position + number of bytes read.
    */
   int readByteBuffer(FSDataInputStream file, ByteBuffer dest) throws IOException;
+
+  /**
+   * Get Delegation token and add it to Credential.
+   * @param fs FileSystem object to HDFS
+   * @param cred Credentials object to add the token to.
+   * @param uname user name.
+   * @throws IOException If an error occurred on adding the token.
+   */
+  public void addDelegationTokens(FileSystem fs, Credentials cred, String uname) throws IOException;
 }

http://git-wip-us.apache.org/repos/asf/hive/blob/487d6c8a/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShimsSecure.java
----------------------------------------------------------------------
diff --git a/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShimsSecure.java
b/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShimsSecure.java
index 279a02c..89d7798 100644
--- a/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShimsSecure.java
+++ b/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShimsSecure.java
@@ -49,6 +49,7 @@ import org.apache.hadoop.mapred.Reporter;
 import org.apache.hadoop.mapred.lib.CombineFileInputFormat;
 import org.apache.hadoop.mapred.lib.CombineFileSplit;
 import org.apache.hadoop.mapreduce.Job;
+import org.apache.hadoop.security.Credentials;
 import org.apache.hadoop.util.Progressable;
 
 /**
@@ -388,4 +389,7 @@ public abstract class HadoopShimsSecure implements HadoopShims {
       throws IOException, AccessControlException, Exception {
     DefaultFileAccess.checkFileAccess(fs, stat, action);
   }
+
+  @Override
+  abstract public void addDelegationTokens(FileSystem fs, Credentials cred, String uname)
throws IOException;
 }


Mime
View raw message