YARN-6647. RM can crash during transitionToStandby due to InterruptedException. Contributed by Bibin A Chundatt
(cherry picked from commit a2c7a73e33
)
This commit is contained in:
parent
8bf74f325a
commit
a4f1e3036d
|
@ -82,16 +82,23 @@ public class RMDelegationTokenSecretManager extends
|
||||||
return new RMDelegationTokenIdentifier();
|
return new RMDelegationTokenIdentifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean shouldIgnoreException(Exception e) {
|
||||||
|
return !running && e.getCause() instanceof InterruptedException;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void storeNewMasterKey(DelegationKey newKey) {
|
protected void storeNewMasterKey(DelegationKey newKey) {
|
||||||
try {
|
try {
|
||||||
LOG.info("storing master key with keyID " + newKey.getKeyId());
|
LOG.info("storing master key with keyID " + newKey.getKeyId());
|
||||||
rm.getRMContext().getStateStore().storeRMDTMasterKey(newKey);
|
rm.getRMContext().getStateStore().storeRMDTMasterKey(newKey);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Error in storing master key with KeyID: " + newKey.getKeyId());
|
if (!shouldIgnoreException(e)) {
|
||||||
|
LOG.error(
|
||||||
|
"Error in storing master key with KeyID: " + newKey.getKeyId());
|
||||||
ExitUtil.terminate(1, e);
|
ExitUtil.terminate(1, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void removeStoredMasterKey(DelegationKey key) {
|
protected void removeStoredMasterKey(DelegationKey key) {
|
||||||
|
@ -99,10 +106,12 @@ public class RMDelegationTokenSecretManager extends
|
||||||
LOG.info("removing master key with keyID " + key.getKeyId());
|
LOG.info("removing master key with keyID " + key.getKeyId());
|
||||||
rm.getRMContext().getStateStore().removeRMDTMasterKey(key);
|
rm.getRMContext().getStateStore().removeRMDTMasterKey(key);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
if (!shouldIgnoreException(e)) {
|
||||||
LOG.error("Error in removing master key with KeyID: " + key.getKeyId());
|
LOG.error("Error in removing master key with KeyID: " + key.getKeyId());
|
||||||
ExitUtil.terminate(1, e);
|
ExitUtil.terminate(1, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void storeNewToken(RMDelegationTokenIdentifier identifier,
|
protected void storeNewToken(RMDelegationTokenIdentifier identifier,
|
||||||
|
@ -113,11 +122,13 @@ public class RMDelegationTokenSecretManager extends
|
||||||
rm.getRMContext().getStateStore().storeRMDelegationToken(identifier,
|
rm.getRMContext().getStateStore().storeRMDelegationToken(identifier,
|
||||||
renewDate);
|
renewDate);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
if (!shouldIgnoreException(e)) {
|
||||||
LOG.error("Error in storing RMDelegationToken with sequence number: "
|
LOG.error("Error in storing RMDelegationToken with sequence number: "
|
||||||
+ identifier.getSequenceNumber());
|
+ identifier.getSequenceNumber());
|
||||||
ExitUtil.terminate(1, e);
|
ExitUtil.terminate(1, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateStoredToken(RMDelegationTokenIdentifier id,
|
protected void updateStoredToken(RMDelegationTokenIdentifier id,
|
||||||
|
@ -127,11 +138,13 @@ public class RMDelegationTokenSecretManager extends
|
||||||
+ id.getSequenceNumber());
|
+ id.getSequenceNumber());
|
||||||
rm.getRMContext().getStateStore().updateRMDelegationToken(id, renewDate);
|
rm.getRMContext().getStateStore().updateRMDelegationToken(id, renewDate);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Error in updating persisted RMDelegationToken" +
|
if (!shouldIgnoreException(e)) {
|
||||||
" with sequence number: " + id.getSequenceNumber());
|
LOG.error("Error in updating persisted RMDelegationToken"
|
||||||
|
+ " with sequence number: " + id.getSequenceNumber());
|
||||||
ExitUtil.terminate(1, e);
|
ExitUtil.terminate(1, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void removeStoredToken(RMDelegationTokenIdentifier ident)
|
protected void removeStoredToken(RMDelegationTokenIdentifier ident)
|
||||||
|
@ -141,11 +154,14 @@ public class RMDelegationTokenSecretManager extends
|
||||||
+ ident.getSequenceNumber());
|
+ ident.getSequenceNumber());
|
||||||
rm.getRMContext().getStateStore().removeRMDelegationToken(ident);
|
rm.getRMContext().getStateStore().removeRMDelegationToken(ident);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Error in removing RMDelegationToken with sequence number: "
|
if (!shouldIgnoreException(e)) {
|
||||||
|
LOG.error(
|
||||||
|
"Error in removing RMDelegationToken with sequence number: "
|
||||||
+ ident.getSequenceNumber());
|
+ ident.getSequenceNumber());
|
||||||
ExitUtil.terminate(1, e);
|
ExitUtil.terminate(1, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Private
|
@Private
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
|
Loading…
Reference in New Issue