YARN-2340. Fixed NPE when queue is stopped during RM restart. Contributed by Rohith Sharmaks

This commit is contained in:
Jian He 2014-12-22 21:53:22 -08:00
parent fdf042dfff
commit 0d89859b51
3 changed files with 13 additions and 5 deletions

View File

@ -266,6 +266,9 @@ Release 2.7.0 - UNRELEASED
YARN-2920. Changed CapacityScheduler to kill containers on nodes where YARN-2920. Changed CapacityScheduler to kill containers on nodes where
node labels are changed. (Wangda Tan via jianhe) node labels are changed. (Wangda Tan via jianhe)
YARN-2340. Fixed NPE when queue is stopped during RM restart.
(Rohith Sharmaks via jianhe)
Release 2.6.0 - 2014-11-18 Release 2.6.0 - 2014-11-18
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -706,11 +706,14 @@ private synchronized void addApplication(ApplicationId applicationId,
try { try {
queue.submitApplication(applicationId, user, queueName); queue.submitApplication(applicationId, user, queueName);
} catch (AccessControlException ace) { } catch (AccessControlException ace) {
LOG.info("Failed to submit application " + applicationId + " to queue " // Ignore the exception for recovered app as the app was previously accepted
+ queueName + " from user " + user, ace); if (!isAppRecovering) {
this.rmContext.getDispatcher().getEventHandler() LOG.info("Failed to submit application " + applicationId + " to queue "
.handle(new RMAppRejectedEvent(applicationId, ace.toString())); + queueName + " from user " + user, ace);
return; this.rmContext.getDispatcher().getEventHandler()
.handle(new RMAppRejectedEvent(applicationId, ace.toString()));
return;
}
} }
// update the metrics // update the metrics
queue.getMetrics().submitApp(user); queue.getMetrics().submitApp(user);

View File

@ -500,6 +500,8 @@ public void testCapacitySchedulerRecovery() throws Exception {
rm1.clearQueueMetrics(app1_2); rm1.clearQueueMetrics(app1_2);
rm1.clearQueueMetrics(app2); rm1.clearQueueMetrics(app2);
csConf.set("yarn.scheduler.capacity.root.Default.QueueB.state", "STOPPED");
// Re-start RM // Re-start RM
rm2 = new MockRM(csConf, memStore); rm2 = new MockRM(csConf, memStore);
rm2.start(); rm2.start();