Skip to content

Commit 60c95e9

Browse files
committed
YARN-9565. RMAppImpl#ranNodes not cleared on FinalTransition. Contributed by Bilwa S T.
1 parent f918e3f commit 60c95e9

File tree

2 files changed

+6
-0
lines changed
  • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src

2 files changed

+6
-0
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,6 +1522,7 @@ private void completeAndCleanupApp(RMAppImpl app) {
15221522
app.handler.handle(
15231523
new RMNodeCleanAppEvent(nodeId, app.applicationId));
15241524
}
1525+
app.ranNodes.clear();
15251526
// Recovered apps that are completed were not added to scheduler, so no
15261527
// need to remove them from scheduler.
15271528
if (app.recoveredFinalState == null) {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import org.apache.hadoop.yarn.api.records.LocalResourceType;
4646
import org.apache.hadoop.yarn.api.records.LocalResourceVisibility;
4747
import org.apache.hadoop.yarn.api.records.LogAggregationContext;
48+
import org.apache.hadoop.yarn.api.records.NodeId;
4849
import org.apache.hadoop.yarn.api.records.Priority;
4950
import org.apache.hadoop.yarn.api.records.ResourceRequest;
5051
import org.apache.hadoop.yarn.api.records.URL;
@@ -569,13 +570,16 @@ protected RMApp testCreateAppSubmittedRecovery(
569570
protected RMApp testCreateAppAccepted(
570571
ApplicationSubmissionContext submissionContext) throws IOException {
571572
RMApp application = testCreateAppSubmittedNoRecovery(submissionContext);
573+
NodeId nodeId = NodeId.newInstance("host", 1234);
572574
// SUBMITTED => ACCEPTED event RMAppEventType.APP_ACCEPTED
573575
RMAppEvent event =
574576
new RMAppEvent(application.getApplicationId(),
575577
RMAppEventType.APP_ACCEPTED);
576578
application.handle(event);
577579
assertStartTimeSet(application);
578580
assertAppState(RMAppState.ACCEPTED, application);
581+
application.handle(
582+
new RMAppRunningOnNodeEvent(application.getApplicationId(), nodeId));
579583
return application;
580584
}
581585

@@ -1089,6 +1093,7 @@ public void testAppFinishedFinished() throws Exception {
10891093
rmDispatcher.await();
10901094
assertTimesAtFinish(application);
10911095
assertAppState(RMAppState.FINISHED, application);
1096+
Assert.assertEquals(0, application.getRanNodes().size());
10921097
StringBuilder diag = application.getDiagnostics();
10931098
Assert.assertEquals("application diagnostics is not correct",
10941099
"", diag.toString());

0 commit comments

Comments
 (0)