You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gobblin.apache.org by hu...@apache.org on 2017/12/08 00:35:44 UTC
incubator-gobblin git commit: [GOBBLIN-337] Hive config token
signature
Repository: incubator-gobblin
Updated Branches:
refs/heads/master 1be745524 -> 8c338be3d
[GOBBLIN-337] Hive config token signature
Closes #2192 from
autumnust/hiveConfigTokenSignature
Project: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/commit/8c338be3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/tree/8c338be3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/diff/8c338be3
Branch: refs/heads/master
Commit: 8c338be3d8bd05f114c960a944dbfad17665060c
Parents: 1be7455
Author: Lei Sun <au...@gmail.com>
Authored: Thu Dec 7 16:35:38 2017 -0800
Committer: Hung Tran <hu...@linkedin.com>
Committed: Thu Dec 7 16:35:38 2017 -0800
----------------------------------------------------------------------
.../java/org/apache/gobblin/util/hadoop/TokenUtils.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/8c338be3/gobblin-utility/src/main/java/org/apache/gobblin/util/hadoop/TokenUtils.java
----------------------------------------------------------------------
diff --git a/gobblin-utility/src/main/java/org/apache/gobblin/util/hadoop/TokenUtils.java b/gobblin-utility/src/main/java/org/apache/gobblin/util/hadoop/TokenUtils.java
index fb45e14..8c70a13 100644
--- a/gobblin-utility/src/main/java/org/apache/gobblin/util/hadoop/TokenUtils.java
+++ b/gobblin-utility/src/main/java/org/apache/gobblin/util/hadoop/TokenUtils.java
@@ -52,7 +52,6 @@ import org.apache.hadoop.security.Credentials;
import org.apache.hadoop.security.SecurityUtil;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.token.Token;
-import org.apache.hadoop.security.token.TokenIdentifier;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
import org.apache.hadoop.yarn.ipc.YarnRPC;
import org.apache.hadoop.yarn.util.ConverterUtils;
@@ -125,7 +124,7 @@ public class TokenUtils {
// Will add hive tokens into ugi in this method.
getHiveToken(state, client, cred, targetUser, ugi);
- if (tokenFile.isPresent()){
+ if (tokenFile.isPresent()) {
persistTokens(cred, tokenFile.get());
}
// at this point, tokens in ugi can be more than that in Credential object,
@@ -191,11 +190,12 @@ public class TokenUtils {
public static void getHiveToken(final State state, IMetaStoreClient hiveClient, Credentials cred,
final String userToProxy, UserGroupInformation ugi) {
try {
- // Fetch and save the default hcat token.
- LOG.info("Fetching default Hive MetaStore token from hive");
+ // Fetch the delegation token with "service" field overwritten with the metastore.uri configuration.
+ // org.apache.gobblin.hive.HiveMetaStoreClientFactory.getHiveConf(com.google.common.base.Optional<java.lang.String>)
+ // sets the signature field to the same value to retrieve the token correctly.
HiveConf hiveConf = new HiveConf();
-
- Token<DelegationTokenIdentifier> hcatToken = fetchHcatToken(userToProxy, hiveConf, null, hiveClient);
+ Token<DelegationTokenIdentifier> hcatToken =
+ fetchHcatToken(userToProxy, hiveConf, hiveConf.get(HiveConf.ConfVars.METASTOREURIS.varname), hiveClient);
cred.addToken(hcatToken.getService(), hcatToken);
ugi.addToken(hcatToken);