HDFS-10735 Distcp using webhdfs on secure HA clusters fails with StandbyException

This commit is contained in:
Benoy Antony 2016-10-14 10:26:39 -07:00
parent 8a9f6635a3
commit 701c27a776
1 changed files with 8 additions and 0 deletions

View File

@ -91,6 +91,7 @@ import org.apache.hadoop.io.retry.RetryPolicies;
import org.apache.hadoop.io.retry.RetryPolicy; import org.apache.hadoop.io.retry.RetryPolicy;
import org.apache.hadoop.io.retry.RetryUtils; import org.apache.hadoop.io.retry.RetryUtils;
import org.apache.hadoop.ipc.RemoteException; import org.apache.hadoop.ipc.RemoteException;
import org.apache.hadoop.ipc.StandbyException;
import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.security.AccessControlException; import org.apache.hadoop.security.AccessControlException;
import org.apache.hadoop.security.SecurityUtil; import org.apache.hadoop.security.SecurityUtil;
@ -471,6 +472,13 @@ public class WebHdfsFileSystem extends FileSystem
} }
IOException re = JsonUtilClient.toRemoteException(m); IOException re = JsonUtilClient.toRemoteException(m);
//check if exception is due to communication with a Standby name node
if (re.getMessage() != null && re.getMessage().endsWith(
StandbyException.class.getSimpleName())) {
LOG.trace("Detected StandbyException", re);
throw new IOException(re);
}
// extract UGI-related exceptions and unwrap InvalidToken // extract UGI-related exceptions and unwrap InvalidToken
// the NN mangles these exceptions but the DN does not and may need // the NN mangles these exceptions but the DN does not and may need
// to re-fetch a token if either report the token is expired // to re-fetch a token if either report the token is expired