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