MAPREDUCE-6285. ClientServiceDelegate should not retry upon AuthenticationException. Contributed by Jonathan Eagles.
(cherry picked from commit 4170c99147
)
This commit is contained in:
parent
a732b58beb
commit
94eb8e5b3d
|
@ -245,6 +245,9 @@ Release 2.7.0 - UNRELEASED
|
||||||
MAPREDUCE-6275. Race condition in FileOutputCommitter v2 for
|
MAPREDUCE-6275. Race condition in FileOutputCommitter v2 for
|
||||||
user-specified task output subdirs (Gera Shegalov and Siqi Li via jlowe)
|
user-specified task output subdirs (Gera Shegalov and Siqi Li via jlowe)
|
||||||
|
|
||||||
|
MAPREDUCE-6285. ClientServiceDelegate should not retry upon
|
||||||
|
AuthenticationException. (Jonathan Eagles via ozawa)
|
||||||
|
|
||||||
Release 2.6.1 - UNRELEASED
|
Release 2.6.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -64,6 +64,7 @@ import org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptReport;
|
||||||
import org.apache.hadoop.mapreduce.v2.util.MRApps;
|
import org.apache.hadoop.mapreduce.v2.util.MRApps;
|
||||||
import org.apache.hadoop.net.NetUtils;
|
import org.apache.hadoop.net.NetUtils;
|
||||||
import org.apache.hadoop.security.UserGroupInformation;
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
|
import org.apache.hadoop.security.authorize.AuthorizationException;
|
||||||
import org.apache.hadoop.security.token.Token;
|
import org.apache.hadoop.security.token.Token;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
||||||
|
@ -328,6 +329,11 @@ public class ClientServiceDelegate {
|
||||||
// Force reconnection by setting the proxy to null.
|
// Force reconnection by setting the proxy to null.
|
||||||
realProxy = null;
|
realProxy = null;
|
||||||
// HS/AMS shut down
|
// HS/AMS shut down
|
||||||
|
|
||||||
|
if (e.getCause() instanceof AuthorizationException) {
|
||||||
|
throw new IOException(e.getTargetException());
|
||||||
|
}
|
||||||
|
|
||||||
// if it's AM shut down, do not decrement maxClientRetry as we wait for
|
// if it's AM shut down, do not decrement maxClientRetry as we wait for
|
||||||
// AM to be restarted.
|
// AM to be restarted.
|
||||||
if (!usingAMProxy.get()) {
|
if (!usingAMProxy.get()) {
|
||||||
|
|
|
@ -48,6 +48,7 @@ import org.apache.hadoop.mapreduce.v2.api.records.Counters;
|
||||||
import org.apache.hadoop.mapreduce.v2.api.records.JobReport;
|
import org.apache.hadoop.mapreduce.v2.api.records.JobReport;
|
||||||
import org.apache.hadoop.mapreduce.v2.api.records.JobState;
|
import org.apache.hadoop.mapreduce.v2.api.records.JobState;
|
||||||
import org.apache.hadoop.mapreduce.v2.util.MRBuilderUtils;
|
import org.apache.hadoop.mapreduce.v2.util.MRBuilderUtils;
|
||||||
|
import org.apache.hadoop.security.authorize.AuthorizationException;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
||||||
|
@ -182,6 +183,49 @@ public class TestClientServiceDelegate {
|
||||||
verify(amProxy, times(5)).getJobReport(any(GetJobReportRequest.class));
|
verify(amProxy, times(5)).getJobReport(any(GetJobReportRequest.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNoRetryOnAMAuthorizationException() throws Exception {
|
||||||
|
if (!isAMReachableFromClient) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ResourceMgrDelegate rm = mock(ResourceMgrDelegate.class);
|
||||||
|
when(rm.getApplicationReport(TypeConverter.toYarn(oldJobId).getAppId()))
|
||||||
|
.thenReturn(getRunningApplicationReport("am1", 78));
|
||||||
|
|
||||||
|
// throw authorization exception on first invocation
|
||||||
|
final MRClientProtocol amProxy = mock(MRClientProtocol.class);
|
||||||
|
when(amProxy.getJobReport(any(GetJobReportRequest.class)))
|
||||||
|
.thenThrow(new AuthorizationException("Denied"));
|
||||||
|
Configuration conf = new YarnConfiguration();
|
||||||
|
conf.set(MRConfig.FRAMEWORK_NAME, MRConfig.YARN_FRAMEWORK_NAME);
|
||||||
|
conf.setBoolean(MRJobConfig.JOB_AM_ACCESS_DISABLED,
|
||||||
|
!isAMReachableFromClient);
|
||||||
|
ClientServiceDelegate clientServiceDelegate =
|
||||||
|
new ClientServiceDelegate(conf, rm, oldJobId, null) {
|
||||||
|
@Override
|
||||||
|
MRClientProtocol instantiateAMProxy(
|
||||||
|
final InetSocketAddress serviceAddr) throws IOException {
|
||||||
|
super.instantiateAMProxy(serviceAddr);
|
||||||
|
return amProxy;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
clientServiceDelegate.getJobStatus(oldJobId);
|
||||||
|
Assert.fail("Exception should be thrown upon AuthorizationException");
|
||||||
|
} catch (IOException e) {
|
||||||
|
Assert.assertEquals(AuthorizationException.class.getName() + ": Denied",
|
||||||
|
e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
// assert maxClientRetry is not decremented.
|
||||||
|
Assert.assertEquals(conf.getInt(MRJobConfig.MR_CLIENT_MAX_RETRIES,
|
||||||
|
MRJobConfig.DEFAULT_MR_CLIENT_MAX_RETRIES), clientServiceDelegate
|
||||||
|
.getMaxClientRetry());
|
||||||
|
verify(amProxy, times(1)).getJobReport(any(GetJobReportRequest.class));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHistoryServerNotConfigured() throws Exception {
|
public void testHistoryServerNotConfigured() throws Exception {
|
||||||
//RM doesn't have app report and job History Server is not configured
|
//RM doesn't have app report and job History Server is not configured
|
||||||
|
|
Loading…
Reference in New Issue