HADOOP-18824. ZKDelegationTokenSecretManager causes ArithmeticException due to improper numRetries value checking (#6052)
This commit is contained in:
parent
dea446419f
commit
23360b3f6b
@ -222,7 +222,7 @@ public ZKDelegationTokenSecretManager(Configuration conf) {
|
||||
ZK_DTSM_ZK_CONNECTION_TIMEOUT_DEFAULT)
|
||||
)
|
||||
.retryPolicy(
|
||||
new RetryNTimes(numRetries, sessionT / numRetries));
|
||||
new RetryNTimes(numRetries, numRetries == 0 ? 0 : sessionT / numRetries));
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException("Could not Load ZK acls or auth: " + ex, ex);
|
||||
}
|
||||
|
@ -106,10 +106,22 @@ protected Configuration getSecretConf(String connectString) {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testMultiNodeOperations() throws Exception {
|
||||
testMultiNodeOperationsImpl(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiNodeOperationsWithZeroRetry() throws Exception {
|
||||
testMultiNodeOperationsImpl(true);
|
||||
}
|
||||
|
||||
public void testMultiNodeOperationsImpl(boolean setZeroRetry) throws Exception {
|
||||
for (int i = 0; i < TEST_RETRIES; i++) {
|
||||
DelegationTokenManager tm1, tm2 = null;
|
||||
String connectString = zkServer.getConnectString();
|
||||
Configuration conf = getSecretConf(connectString);
|
||||
if (setZeroRetry) {
|
||||
conf.setInt(ZKDelegationTokenSecretManager.ZK_DTSM_ZK_NUM_RETRIES, 0);
|
||||
}
|
||||
tm1 = new DelegationTokenManager(conf, new Text("bla"));
|
||||
tm1.init();
|
||||
tm2 = new DelegationTokenManager(conf, new Text("bla"));
|
||||
|
Loading…
Reference in New Issue
Block a user