HADOOP-16692: UserGroupInformation Sets kerberosMinSecondsBeforeRelogin as Millis
This commit is contained in:
parent
fb512f5087
commit
9b673227e4
|
@ -336,7 +336,7 @@ public class UserGroupInformation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
kerberosMinSecondsBeforeRelogin = 1000L * conf.getLong(
|
kerberosMinSecondsBeforeRelogin = conf.getLong(
|
||||||
HADOOP_KERBEROS_MIN_SECONDS_BEFORE_RELOGIN,
|
HADOOP_KERBEROS_MIN_SECONDS_BEFORE_RELOGIN,
|
||||||
HADOOP_KERBEROS_MIN_SECONDS_BEFORE_RELOGIN_DEFAULT);
|
HADOOP_KERBEROS_MIN_SECONDS_BEFORE_RELOGIN_DEFAULT);
|
||||||
}
|
}
|
||||||
|
@ -389,7 +389,7 @@ public class UserGroupInformation {
|
||||||
authenticationMethod = null;
|
authenticationMethod = null;
|
||||||
conf = null;
|
conf = null;
|
||||||
groups = null;
|
groups = null;
|
||||||
kerberosMinSecondsBeforeRelogin = 0;
|
kerberosMinSecondsBeforeRelogin = 0L;
|
||||||
kerberosKeyTabLoginRenewalEnabled = false;
|
kerberosKeyTabLoginRenewalEnabled = false;
|
||||||
kerberosLoginRenewalExecutor = Optional.empty();
|
kerberosLoginRenewalExecutor = Optional.empty();
|
||||||
setLoginUser(null);
|
setLoginUser(null);
|
||||||
|
@ -1009,7 +1009,7 @@ public class UserGroupInformation {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nextRefresh = Math.max(getRefreshTime(tgt),
|
nextRefresh = Math.max(getRefreshTime(tgt),
|
||||||
now + kerberosMinSecondsBeforeRelogin);
|
now + TimeUnit.SECONDS.toMillis(kerberosMinSecondsBeforeRelogin));
|
||||||
metrics.renewalFailures.set(0);
|
metrics.renewalFailures.set(0);
|
||||||
rp = null;
|
rp = null;
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
|
@ -1051,7 +1051,7 @@ public class UserGroupInformation {
|
||||||
// The final retry time will be later limited within the
|
// The final retry time will be later limited within the
|
||||||
// tgt endTime in getNextTgtRenewalTime.
|
// tgt endTime in getNextTgtRenewalTime.
|
||||||
rp = RetryPolicies.exponentialBackoffRetry(Long.SIZE - 2,
|
rp = RetryPolicies.exponentialBackoffRetry(Long.SIZE - 2,
|
||||||
kerberosMinSecondsBeforeRelogin, TimeUnit.MILLISECONDS);
|
kerberosMinSecondsBeforeRelogin, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
nextRefresh = getNextTgtRenewalTime(tgtEndTime, now, rp);
|
nextRefresh = getNextTgtRenewalTime(tgtEndTime, now, rp);
|
||||||
|
@ -1130,7 +1130,8 @@ public class UserGroupInformation {
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static long getNextTgtRenewalTime(final long tgtEndTime, final long now,
|
static long getNextTgtRenewalTime(final long tgtEndTime, final long now,
|
||||||
final RetryPolicy rp) throws Exception {
|
final RetryPolicy rp) throws Exception {
|
||||||
final long lastRetryTime = tgtEndTime - kerberosMinSecondsBeforeRelogin;
|
final long lastRetryTime =
|
||||||
|
tgtEndTime - TimeUnit.SECONDS.toMillis(kerberosMinSecondsBeforeRelogin);
|
||||||
final RetryPolicy.RetryAction ra = rp.shouldRetry(null,
|
final RetryPolicy.RetryAction ra = rp.shouldRetry(null,
|
||||||
metrics.renewalFailures.value(), 0, false);
|
metrics.renewalFailures.value(), 0, false);
|
||||||
return Math.min(lastRetryTime, now + ra.delayMillis);
|
return Math.min(lastRetryTime, now + ra.delayMillis);
|
||||||
|
@ -1378,10 +1379,11 @@ public class UserGroupInformation {
|
||||||
|
|
||||||
private boolean hasSufficientTimeElapsed(long now) {
|
private boolean hasSufficientTimeElapsed(long now) {
|
||||||
if (!shouldRenewImmediatelyForTests &&
|
if (!shouldRenewImmediatelyForTests &&
|
||||||
now - user.getLastLogin() < kerberosMinSecondsBeforeRelogin ) {
|
(now - user.getLastLogin()) < TimeUnit.SECONDS
|
||||||
LOG.warn("Not attempting to re-login since the last re-login was " +
|
.toMillis(kerberosMinSecondsBeforeRelogin)) {
|
||||||
"attempted less than " + (kerberosMinSecondsBeforeRelogin/1000) +
|
LOG.warn("Not attempting to re-login since the last re-login was "
|
||||||
" seconds before. Last Login=" + user.getLastLogin());
|
+ "attempted less than " + kerberosMinSecondsBeforeRelogin
|
||||||
|
+ " seconds before. Last Login=" + user.getLastLogin());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue