Source:
<code><START> public synchronized void reloginFromKeytab(boolean ignoreTimeElapsed) <END> throws IOException { if (!isSecurityEnabled() || user.getAuthenticationMethod() != AuthenticationMethod.KERBEROS || !isKeytab) { return; } long now = Time.now(); if (!shouldRenewImmediatelyForTests && !ignoreTimeElapsed && !hasSufficientTimeElapsed(now)) { return; } KerberosTicket tgt = getTGT(); if (tgt != null && !shouldRenewImmediatelyForTests && now < getRefreshTime(tgt)) { return; } LoginContext login = getLogin(); if (login == null || keytabFile == null) { throw new KerberosAuthException(MUST_FIRST_LOGIN_FROM_KEYTAB); } long start = 0; user.setLastLogin(now); try { if (LOG.isDebugEnabled()) { LOG.debug("Initiating logout for " + getUserName()); } synchronized (UserGroupInformation.class) { login.logout(); login = newLoginContext( HadoopConfiguration.KEYTAB_KERBEROS_CONFIG_NAME, getSubject(), new HadoopConfiguration()); if (LOG.isDebugEnabled()) { LOG.debug("Initiating re-login for " + keytabPrincipal); } start = Time.now(); login.login(); fixKerberosTicketOrder(); metrics.loginSuccess.add(Time.now() - start); setLogin(login); } } catch (LoginException le) { if (start > 0) { metrics.loginFailure.add(Time.now() - start); } KerberosAuthException kae = new KerberosAuthException(LOGIN_FAILURE, le); kae.setPrincipal(keytabPrincipal); kae.setKeytabFile(keytabFile); throw kae; } }</code><technical_language>thinking of problem of method signature potential Hadoop 2 code calling reloginFromKeytab(false) upgrades Hadoop 3. of method name a bool parameter, users notice parameter is for meanings: in Hadoop 2 here, bool parameter is for ignoreTimeElapsed in Hadoop 3 is for checkTGT. is to: 1. this new API public synchronized void reloginFromKeytab(boolean ignoreTimeElapsed) private 2. add new API in Hadoop 3: public void forceReloginFromKeytab(). way, application code forces login code Hadoop 2 3. other new API reloginFromKeytab(boolean) is private in UGI in Hadoop 2 3</technical_language>

Target:
private synchronized void reloginFromKeytab(boolean ignoreTimeElapsed) throws IOException { if (!isSecurityEnabled() || user.getAuthenticationMethod() != AuthenticationMethod.KERBEROS || !isKeytab) { return; } long now = Time.now(); if (!shouldRenewImmediatelyForTests && !ignoreTimeElapsed && !hasSufficientTimeElapsed(now)) { return; } KerberosTicket tgt = getTGT(); if (tgt != null && !shouldRenewImmediatelyForTests && now < getRefreshTime(tgt)) { return; } LoginContext login = getLogin(); if (login == null || keytabFile == null) { throw new KerberosAuthException(MUST_FIRST_LOGIN_FROM_KEYTAB); } long start = 0; user.setLastLogin(now); try { if (LOG.isDebugEnabled()) { LOG.debug("Initiating logout for " + getUserName()); } synchronized (UserGroupInformation.class) { login.logout(); login = newLoginContext( HadoopConfiguration.KEYTAB_KERBEROS_CONFIG_NAME, getSubject(), new HadoopConfiguration()); if (LOG.isDebugEnabled()) { LOG.debug("Initiating re-login for " + keytabPrincipal); } start = Time.now(); login.login(); fixKerberosTicketOrder(); metrics.loginSuccess.add(Time.now() - start); setLogin(login); } } catch (LoginException le) { if (start > 0) { metrics.loginFailure.add(Time.now() - start); } KerberosAuthException kae = new KerberosAuthException(LOGIN_FAILURE, le); kae.setPrincipal(keytabPrincipal); kae.setKeytabFile(keytabFile); throw kae; } }