You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by br...@apache.org on 2014/12/23 16:44:50 UTC
svn commit: r1647597 - in
/hive/trunk/shims/common/src/main/java/org/apache/hadoop/hive/thrift:
DBTokenStore.java HadoopThriftAuthBridge.java MemoryTokenStore.java
Author: brock
Date: Tue Dec 23 15:44:50 2014
New Revision: 1647597
URL: http://svn.apache.org/r1647597
Log:
HIVE-9176 - Delegation token interval should be configurable in HadoopThriftAuthBridge (Brock reviewed by Prasad)
Modified:
hive/trunk/shims/common/src/main/java/org/apache/hadoop/hive/thrift/DBTokenStore.java
hive/trunk/shims/common/src/main/java/org/apache/hadoop/hive/thrift/HadoopThriftAuthBridge.java
hive/trunk/shims/common/src/main/java/org/apache/hadoop/hive/thrift/MemoryTokenStore.java
Modified: hive/trunk/shims/common/src/main/java/org/apache/hadoop/hive/thrift/DBTokenStore.java
URL: http://svn.apache.org/viewvc/hive/trunk/shims/common/src/main/java/org/apache/hadoop/hive/thrift/DBTokenStore.java?rev=1647597&r1=1647596&r2=1647597&view=diff
==============================================================================
--- hive/trunk/shims/common/src/main/java/org/apache/hadoop/hive/thrift/DBTokenStore.java (original)
+++ hive/trunk/shims/common/src/main/java/org/apache/hadoop/hive/thrift/DBTokenStore.java Tue Dec 23 15:44:50 2014
@@ -73,7 +73,7 @@ public class DBTokenStore implements Del
boolean result = (Boolean)invokeOnRawStore("addToken", new Object[] {identifier, tokenStr},
String.class, String.class);
if (LOG.isTraceEnabled()) {
- LOG.trace("addToken: tokenIdentifier = " + tokenIdentifier + ", addded = " + result);
+ LOG.trace("addToken: tokenIdentifier = " + tokenIdentifier + ", added = " + result);
}
return result;
} catch (IOException e) {
@@ -106,7 +106,7 @@ public class DBTokenStore implements Del
boolean result = (Boolean)invokeOnRawStore("removeToken", new Object[] {
TokenStoreDelegationTokenSecretManager.encodeWritable(tokenIdentifier)}, String.class);
if (LOG.isTraceEnabled()) {
- LOG.trace("removeToken: tokenIdentifier = " + tokenIdentifier + ", addded = " + result);
+ LOG.trace("removeToken: tokenIdentifier = " + tokenIdentifier + ", removed = " + result);
}
return result;
} catch (IOException e) {
Modified: hive/trunk/shims/common/src/main/java/org/apache/hadoop/hive/thrift/HadoopThriftAuthBridge.java
URL: http://svn.apache.org/viewvc/hive/trunk/shims/common/src/main/java/org/apache/hadoop/hive/thrift/HadoopThriftAuthBridge.java?rev=1647597&r1=1647596&r2=1647597&view=diff
==============================================================================
--- hive/trunk/shims/common/src/main/java/org/apache/hadoop/hive/thrift/HadoopThriftAuthBridge.java (original)
+++ hive/trunk/shims/common/src/main/java/org/apache/hadoop/hive/thrift/HadoopThriftAuthBridge.java Tue Dec 23 15:44:50 2014
@@ -73,7 +73,7 @@ import org.apache.thrift.transport.TTran
* SASL callback handlers and authentication classes.
*/
public class HadoopThriftAuthBridge {
- static final Log LOG = LogFactory.getLog(HadoopThriftAuthBridge.class);
+ private static final Log LOG = LogFactory.getLog(HadoopThriftAuthBridge.class);
public Client createClient() {
return new Client();
@@ -290,9 +290,9 @@ public class HadoopThriftAuthBridge {
public enum ServerMode {
HIVESERVER2, METASTORE
};
- final UserGroupInformation realUgi;
- DelegationTokenSecretManager secretManager;
- private final static long DELEGATION_TOKEN_GC_INTERVAL = 3600000; // 1 hour
+ public static final String DELEGATION_TOKEN_GC_INTERVAL =
+ "hive.cluster.delegation.token.gc-interval";
+ private final static long DELEGATION_TOKEN_GC_INTERVAL_DEFAULT = 3600000; // 1 hour
//Delegation token related keys
public static final String DELEGATION_KEY_UPDATE_INTERVAL_KEY =
"hive.cluster.delegation.key.update-interval";
@@ -323,6 +323,9 @@ public class HadoopThriftAuthBridge {
public static final String DELEGATION_TOKEN_STORE_ZK_ZNODE_DEFAULT =
"/hivedelegation";
+ protected final UserGroupInformation realUgi;
+ protected DelegationTokenSecretManager secretManager;
+
public Server() throws TTransportException {
try {
realUgi = UserGroupInformation.getCurrentUser();
@@ -434,13 +437,15 @@ public class HadoopThriftAuthBridge {
long tokenRenewInterval =
conf.getLong(DELEGATION_TOKEN_RENEW_INTERVAL_KEY,
DELEGATION_TOKEN_RENEW_INTERVAL_DEFAULT);
+ long tokenGcInterval = conf.getLong(DELEGATION_TOKEN_GC_INTERVAL,
+ DELEGATION_TOKEN_GC_INTERVAL_DEFAULT);
DelegationTokenStore dts = getTokenStore(conf);
dts.init(rawStore, smode);
secretManager = new TokenStoreDelegationTokenSecretManager(secretKeyInterval,
tokenMaxLifetime,
tokenRenewInterval,
- DELEGATION_TOKEN_GC_INTERVAL, dts);
+ tokenGcInterval, dts);
secretManager.startThreads();
}
Modified: hive/trunk/shims/common/src/main/java/org/apache/hadoop/hive/thrift/MemoryTokenStore.java
URL: http://svn.apache.org/viewvc/hive/trunk/shims/common/src/main/java/org/apache/hadoop/hive/thrift/MemoryTokenStore.java?rev=1647597&r1=1647596&r2=1647597&view=diff
==============================================================================
--- hive/trunk/shims/common/src/main/java/org/apache/hadoop/hive/thrift/MemoryTokenStore.java (original)
+++ hive/trunk/shims/common/src/main/java/org/apache/hadoop/hive/thrift/MemoryTokenStore.java Tue Dec 23 15:44:50 2014
@@ -92,7 +92,7 @@ public class MemoryTokenStore implements
DelegationTokenInformation token) {
DelegationTokenInformation tokenInfo = tokens.putIfAbsent(tokenIdentifier, token);
if (LOG.isTraceEnabled()) {
- LOG.trace("addToken: tokenIdentifier = " + tokenIdentifier + ", addded = " + (tokenInfo == null));
+ LOG.trace("addToken: tokenIdentifier = " + tokenIdentifier + ", added = " + (tokenInfo == null));
}
return (tokenInfo == null);
}