|
@@ -310,6 +310,30 @@ public class RMStateStoreTestBase extends ClientBaseWithFixes{
|
|
|
"myTrackingUrl", "attemptDiagnostics",
|
|
|
FinalApplicationStatus.SUCCEEDED);
|
|
|
store.updateApplicationAttemptState(newAttemptState);
|
|
|
+
|
|
|
+ // test updating the state of an app/attempt whose initial state was not
|
|
|
+ // saved.
|
|
|
+ ApplicationId dummyAppId = ApplicationId.newInstance(1234, 10);
|
|
|
+ ApplicationSubmissionContext dummyContext =
|
|
|
+ new ApplicationSubmissionContextPBImpl();
|
|
|
+ dummyContext.setApplicationId(dummyAppId);
|
|
|
+ ApplicationState dummyApp =
|
|
|
+ new ApplicationState(appState.submitTime, appState.startTime,
|
|
|
+ dummyContext, appState.user, RMAppState.FINISHED, "appDiagnostics",
|
|
|
+ 1234);
|
|
|
+ store.updateApplicationState(dummyApp);
|
|
|
+
|
|
|
+ ApplicationAttemptId dummyAttemptId =
|
|
|
+ ApplicationAttemptId.newInstance(dummyAppId, 6);
|
|
|
+ ApplicationAttemptState dummyAttempt =
|
|
|
+ new ApplicationAttemptState(dummyAttemptId,
|
|
|
+ oldAttemptState.getMasterContainer(),
|
|
|
+ oldAttemptState.getAppAttemptCredentials(),
|
|
|
+ oldAttemptState.getStartTime(), RMAppAttemptState.FINISHED,
|
|
|
+ "myTrackingUrl", "attemptDiagnostics",
|
|
|
+ FinalApplicationStatus.SUCCEEDED);
|
|
|
+ store.updateApplicationAttemptState(dummyAttempt);
|
|
|
+
|
|
|
// let things settle down
|
|
|
Thread.sleep(1000);
|
|
|
store.close();
|
|
@@ -320,6 +344,7 @@ public class RMStateStoreTestBase extends ClientBaseWithFixes{
|
|
|
RMState newRMState = store.loadState();
|
|
|
Map<ApplicationId, ApplicationState> newRMAppState =
|
|
|
newRMState.getApplicationState();
|
|
|
+ assertNotNull(newRMAppState.get(dummyApp.getAppId()));
|
|
|
ApplicationState updatedAppState = newRMAppState.get(appId1);
|
|
|
assertEquals(appState.getAppId(),updatedAppState.getAppId());
|
|
|
assertEquals(appState.getSubmitTime(), updatedAppState.getSubmitTime());
|
|
@@ -331,6 +356,8 @@ public class RMStateStoreTestBase extends ClientBaseWithFixes{
|
|
|
assertEquals(1234, updatedAppState.getFinishTime());
|
|
|
|
|
|
// check updated attempt state
|
|
|
+ assertNotNull(newRMAppState.get(dummyApp.getAppId()).getAttempt(
|
|
|
+ dummyAttemptId));
|
|
|
ApplicationAttemptState updatedAttemptState =
|
|
|
updatedAppState.getAttempt(newAttemptState.getAttemptId());
|
|
|
assertEquals(oldAttemptState.getAttemptId(),
|