You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by kh...@apache.org on 2016/02/12 20:05:27 UTC
hive git commit: HIVE-13017 : Child process of HiveServer2 fails to
get delegation token from non default FileSystem (Sushanth Sowmyan,
reviewed by Thejas M Nair)
Repository: hive
Updated Branches:
refs/heads/master dca4233da -> 860ba06fb
HIVE-13017 : Child process of HiveServer2 fails to get delegation token from non default FileSystem (Sushanth Sowmyan, reviewed by Thejas M Nair)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/860ba06f
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/860ba06f
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/860ba06f
Branch: refs/heads/master
Commit: 860ba06fb67c316616a568ed9edcededf931eede
Parents: dca4233
Author: Sushanth Sowmyan <kh...@gmail.com>
Authored: Fri Feb 12 11:04:21 2016 -0800
Committer: Sushanth Sowmyan <kh...@gmail.com>
Committed: Fri Feb 12 11:05:24 2016 -0800
----------------------------------------------------------------------
.../hadoop/hive/ql/exec/SecureCmdDoAs.java | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/860ba06f/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 974c74e..e1228cc 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
@@ -19,6 +19,8 @@ package org.apache.hadoop.hive.ql.exec;
import java.io.File;
import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.Map;
import org.apache.hadoop.fs.FileSystem;
@@ -28,6 +30,8 @@ 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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* SecureCmdDoAs - Helper class for setting parameters and env necessary for
@@ -36,6 +40,9 @@ import org.apache.hadoop.security.UserGroupInformation;
*
*/
public class SecureCmdDoAs {
+
+ private static final Logger LOG = LoggerFactory.getLogger(SecureCmdDoAs.class);
+
private final Path tokenPath;
private final File tokenFile;
@@ -45,7 +52,18 @@ public class SecureCmdDoAs {
String uname = UserGroupInformation.getLoginUser().getShortUserName();
FileSystem fs = FileSystem.get(conf);
Credentials cred = new Credentials();
- ShimLoader.getHadoopShims().addDelegationTokens(fs, cred, uname);
+
+ ShimLoader.getHadoopShims().addDelegationTokens(fs, cred, uname); // ask default fs first
+ for (String uri : conf.getStringCollection("mapreduce.job.hdfs-servers")) {
+ try {
+ ShimLoader.getHadoopShims().addDelegationTokens(
+ FileSystem.get(new URI(uri), conf),
+ cred, uname);
+ } catch (URISyntaxException e) {
+ LOG.warn("Invalid URI in mapreduce.job.hdfs-servers:["+uri+"], ignoring.", e);
+ }
+ }
+
tokenFile = File.createTempFile("hive_hadoop_delegation_token", null);
tokenPath = new Path(tokenFile.toURI());