Skip to content

Commit

Permalink
HDDS-3366. Ozone Client should not retry on invalid token (#802)
Browse files Browse the repository at this point in the history
  • Loading branch information
adoroszlai committed Apr 9, 2020
1 parent b50e932 commit eb177f4
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
import org.apache.hadoop.security.proto.SecurityProtos.CancelDelegationTokenRequestProto;
import org.apache.hadoop.security.proto.SecurityProtos.GetDelegationTokenRequestProto;
import org.apache.hadoop.security.proto.SecurityProtos.RenewDelegationTokenRequestProto;
import org.apache.hadoop.security.token.SecretManager;
import org.apache.hadoop.security.token.Token;

import com.google.common.annotations.VisibleForTesting;
Expand Down Expand Up @@ -296,13 +297,18 @@ private RetryAction getRetryAction(RetryAction fallbackAction,
}

/**
* Unwrap exception to check if it is a {@link AccessControlException}.
* Unwrap exception to check if it is some kind of access control problem
* ({@link AccessControlException} or {@link SecretManager.InvalidToken}).
*/
private boolean isAccessControlException(Exception ex) {
if (ex instanceof ServiceException) {
Throwable t = ex.getCause();
if (t instanceof RemoteException) {
t = ((RemoteException) t).unwrapRemoteException();
}
while (t != null) {
if (t instanceof AccessControlException) {
if (t instanceof AccessControlException ||
t instanceof SecretManager.InvalidToken) {
return true;
}
t = t.getCause();
Expand Down

0 comments on commit eb177f4

Please sign in to comment.