goiri commented on code in PR #6083:
URL: https://github.com/apache/hadoop/pull/6083#discussion_r1328986100


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/utils/FederationRegistryClient.java:
##########
@@ -203,21 +203,27 @@ public synchronized boolean 
writeAMRMTokenForUAM(ApplicationId appId,
    * Remove an application from registry.
    *
    * @param appId application id
+   * @param ignoreMemoryState whether to ignore the memory data in terms of
+   *          known application
    */
-  public synchronized void removeAppFromRegistry(ApplicationId appId) {
+  public synchronized void removeAppFromRegistry(ApplicationId appId,
+      boolean ignoreMemoryState) {
     Map<String, Token<AMRMTokenIdentifier>> subClusterTokenMap =
         this.appSubClusterTokenMap.get(appId);
-    LOG.info("Removing all registry entries for {}", appId);
-
-    if (subClusterTokenMap == null || subClusterTokenMap.size() == 0) {
-      return;
+    if (!ignoreMemoryState) {
+      if (subClusterTokenMap == null || subClusterTokenMap.size() == 0) {

Review Comment:
   isEmpty?



##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-globalpolicygenerator/src/main/java/org/apache/hadoop/yarn/server/globalpolicygenerator/applicationcleaner/ApplicationCleaner.java:
##########
@@ -148,6 +153,18 @@ public Set<ApplicationId> getRouterKnownApplications() 
throws YarnException {
         + " success Router queries after " + totalAttemptCount + " retries");
   }
 
+  protected void cleanupAppRecordInRegistry(Set<ApplicationId> knownApps) {
+    List<String> allApps = this.registryClient.getAllApplications();
+    LOG.info("Got " + allApps.size() + " existing apps in registry");

Review Comment:
   {} format



##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-globalpolicygenerator/src/test/java/org/apache/hadoop/yarn/server/globalpolicygenerator/applicationcleaner/TestDefaultApplicationCleaner.java:
##########
@@ -96,6 +119,12 @@ public void breakDown() {
       stateStore.close();
       stateStore = null;
     }
+    if (registryClient != null) {
+      registryClient.cleanAllApplications();
+    }
+    if (registry != null) {
+      registry.stop();

Review Comment:
   Reset to null?



##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/utils/FederationRegistryClient.java:
##########
@@ -203,21 +203,27 @@ public synchronized boolean 
writeAMRMTokenForUAM(ApplicationId appId,
    * Remove an application from registry.
    *
    * @param appId application id
+   * @param ignoreMemoryState whether to ignore the memory data in terms of
+   *          known application
    */
-  public synchronized void removeAppFromRegistry(ApplicationId appId) {
+  public synchronized void removeAppFromRegistry(ApplicationId appId,
+      boolean ignoreMemoryState) {

Review Comment:
   Can we have a default method with this as false (or true, whatever is the 
common case), to prevent changing the signature?



-- 
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: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to