diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/thrift/TestZooKeeperTokenStore.java b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/thrift/TestZooKeeperTokenStore.java index 9848cc1..65a10e3 100644 --- a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/thrift/TestZooKeeperTokenStore.java +++ b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/thrift/TestZooKeeperTokenStore.java @@ -122,6 +122,7 @@ public void testTokenStorage() throws Exception { assertTrue(ts.removeToken(tokenId)); assertEquals(0, ts.getAllDelegationTokenIdentifiers().size()); + assertNull(ts.getToken(tokenId)); } public void testAclNoAuth() throws Exception { diff --git a/shims/common/src/main/java/org/apache/hadoop/hive/thrift/TokenStoreDelegationTokenSecretManager.java b/shims/common/src/main/java/org/apache/hadoop/hive/thrift/TokenStoreDelegationTokenSecretManager.java index 8146d51..87b418e 100644 --- a/shims/common/src/main/java/org/apache/hadoop/hive/thrift/TokenStoreDelegationTokenSecretManager.java +++ b/shims/common/src/main/java/org/apache/hadoop/hive/thrift/TokenStoreDelegationTokenSecretManager.java @@ -330,7 +330,6 @@ public void run() { } catch (Throwable t) { LOGGER.error("ExpiredTokenRemover thread received unexpected exception. " + t, t); - Runtime.getRuntime().exit(-1); } } } diff --git a/shims/common/src/main/java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java b/shims/common/src/main/java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java index 745e467..528e55d 100644 --- a/shims/common/src/main/java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java +++ b/shims/common/src/main/java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java @@ -396,6 +396,10 @@ public boolean removeToken(DelegationTokenIdentifier tokenIdentifier) { @Override public DelegationTokenInformation getToken(DelegationTokenIdentifier tokenIdentifier) { byte[] tokenBytes = zkGetData(getTokenPath(tokenIdentifier)); + if(tokenBytes == null) { + // The token is already removed. + return null; + } try { return HiveDelegationTokenSupport.decodeDelegationTokenInformation(tokenBytes); } catch (Exception ex) {