slfan1989 commented on code in PR #4897:
URL: https://github.com/apache/hadoop/pull/4897#discussion_r976165058
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/TestFederationInterceptor.java:
##########
@@ -1242,4 +1255,181 @@ public void testRemoveAppFromRegistryApplicationFailed()
return null;
});
}
+
+ public void testRecoverWithBadSubCluster(final RegistryOperations
registryObj)
+ throws IOException, InterruptedException {
+
+ UserGroupInformation ugi =
+ interceptor.getUGIWithToken(interceptor.getAttemptId());
+
+ // Prepare a list of subclusters
+ List<SubClusterId> subClusterIds = new ArrayList<>();
+ SubClusterId sc1 = SubClusterId.newInstance("SC-1");
+ SubClusterId sc2 = SubClusterId.newInstance("SC-2");
+ SubClusterId homeSC = SubClusterId.newInstance(HOME_SC_ID);
+ subClusterIds.add(sc1);
+ subClusterIds.add(sc2);
+ subClusterIds.add(homeSC);
+
+ // Prepare AMRMProxy Context
+ AMRMProxyApplicationContext appContext = new
AMRMProxyApplicationContextImpl(nmContext,
+ getConf(), attemptId, "test-user", null, null, null, registryObj);
+
+ // Prepare RegisterApplicationMasterRequest
+ RegisterApplicationMasterRequest registerReq =
+ Records.newRecord(RegisterApplicationMasterRequest.class);
+ registerReq.setHost(Integer.toString(testAppId));
+ registerReq.setRpcPort(testAppId);
+ registerReq.setTrackingUrl("");
+
+ ugi.doAs((PrivilegedExceptionAction<Object>) () -> {
+
+ // Step1. Prepare subClusters SC-1, SC-2, HomeSC and Interceptor
+ initSubClusterAndInterceptor(subClusterIds, registryObj);
+
+ // Step2. Register Application And Assign Containers
+ List<Container> containers =
registerApplicationAndAssignContainers(registerReq);
+
+ // Step3. Offline SC-1 cluster
+ offlineSubClusterSC1(sc1);
+
+ // Step4. Recover ApplicationMaster
+ recoverApplicationMaster(appContext);
+
+ // Step5. We recovered ApplicationMaster.
+ // SC-1 was offline, SC-2 was recovered at this time,
UnmanagedAMPool.size=1 and only SC-2
+ UnmanagedAMPoolManager unmanagedAMPoolManager =
interceptor.getUnmanagedAMPool();
+ Set<String> allUAMIds = unmanagedAMPoolManager.getAllUAMIds();
+ Assert.assertNotNull(allUAMIds);
+ Assert.assertTrue(allUAMIds.size() == 1);
Review Comment:
I will fix it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]