slfan1989 commented on code in PR #4846:
URL: https://github.com/apache/hadoop/pull/4846#discussion_r962057944


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/impl/ZookeeperFederationStateStore.java:
##########
@@ -255,23 +260,41 @@ public GetApplicationHomeSubClusterResponse 
getApplicationHomeSubCluster(
   @Override
   public GetApplicationsHomeSubClusterResponse getApplicationsHomeSubCluster(
       GetApplicationsHomeSubClusterRequest request) throws YarnException {
+
+    if (request == null) {
+      throw new YarnException("Missing getApplicationsHomeSubCluster request");
+    }
+
     long start = clock.getTime();
     List<ApplicationHomeSubCluster> result = new ArrayList<>();
+    SubClusterId requestSubClusterId = request.getSubClusterId();
+    int appCount = 0;
 
     try {
-      for (String child : zkManager.getChildren(appsZNode)) {
+      List<String> childrens = zkManager.getChildren(appsZNode);
+      for (String child : childrens) {
+        if (appCount >= maxAppsInStateStore) {
+          break;
+        }
         ApplicationId appId = ApplicationId.fromString(child);
         SubClusterId homeSubCluster = getApp(appId);
-        ApplicationHomeSubCluster app =
-            ApplicationHomeSubCluster.newInstance(appId, homeSubCluster);
+        // If the requestSubClusterId that needs to be filtered in the request
+        // is inconsistent with the SubClusterId in the data, continue to the 
next round
+        if (requestSubClusterId != null && 
!requestSubClusterId.equals(homeSubCluster)) {
+          continue;

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]

Reply via email to