You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by ji...@apache.org on 2020/08/07 00:49:42 UTC

[helix] branch master updated: Update customized view after all calculation is done (#1225)

This is an automated email from the ASF dual-hosted git repository.

jiajunwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git


The following commit(s) were added to refs/heads/master by this push:
     new cdc15fd  Update customized view after all calculation is done (#1225)
cdc15fd is described below

commit cdc15fd76807efea5f82dd21d1af0c847f88194c
Author: Meng Zhang <mn...@linkedin.com>
AuthorDate: Thu Aug 6 17:49:31 2020 -0700

    Update customized view after all calculation is done (#1225)
    
    Update customized view after all calculation is done.
---
 .../stages/CustomizedViewAggregationStage.java     | 46 +++++++++++-----------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/helix-core/src/main/java/org/apache/helix/controller/stages/CustomizedViewAggregationStage.java b/helix-core/src/main/java/org/apache/helix/controller/stages/CustomizedViewAggregationStage.java
index 58888ed..165a0af 100644
--- a/helix-core/src/main/java/org/apache/helix/controller/stages/CustomizedViewAggregationStage.java
+++ b/helix-core/src/main/java/org/apache/helix/controller/stages/CustomizedViewAggregationStage.java
@@ -98,34 +98,34 @@ public class CustomizedViewAggregationStage extends AbstractAsyncBaseStage {
         try {
           computeCustomizedStateView(resource, stateType, customizedStateOutput, curCustomizedViews,
               updatedCustomizedViews);
-
-          List<PropertyKey> keys = new ArrayList<>();
-          for (Iterator<CustomizedView> it = updatedCustomizedViews.iterator(); it.hasNext(); ) {
-            CustomizedView view = it.next();
-            String resourceName = view.getResourceName();
-            keys.add(keyBuilder.customizedView(stateType, resourceName));
-          }
-          // add/update customized-views from zk and cache
-          if (updatedCustomizedViews.size() > 0) {
-            dataAccessor.setChildren(keys, updatedCustomizedViews);
-            cache.updateCustomizedViews(stateType, updatedCustomizedViews);
-          }
-
-          // remove stale customized views from zk and cache
-          List<String> customizedViewToRemove = new ArrayList<>();
-          for (String resourceName : curCustomizedViews.keySet()) {
-            if (!resourceMap.keySet().contains(resourceName)) {
-              LogUtil.logInfo(LOG, _eventId, "Remove customizedView for resource: " + resourceName);
-              dataAccessor.removeProperty(keyBuilder.customizedView(stateType, resourceName));
-              customizedViewToRemove.add(resourceName);
-            }
-          }
-          cache.removeCustomizedViews(stateType, customizedViewToRemove);
         } catch (HelixException ex) {
           LogUtil.logError(LOG, _eventId,
               "Failed to calculate customized view for resource " + resource.getResourceName(), ex);
         }
       }
+
+      List<PropertyKey> keys = new ArrayList<>();
+      for (Iterator<CustomizedView> it = updatedCustomizedViews.iterator(); it.hasNext(); ) {
+        CustomizedView view = it.next();
+        String resourceName = view.getResourceName();
+        keys.add(keyBuilder.customizedView(stateType, resourceName));
+      }
+      // add/update customized-views from zk and cache
+      if (updatedCustomizedViews.size() > 0) {
+        dataAccessor.setChildren(keys, updatedCustomizedViews);
+        cache.updateCustomizedViews(stateType, updatedCustomizedViews);
+      }
+
+      // remove stale customized views from zk and cache
+      List<String> customizedViewToRemove = new ArrayList<>();
+      for (String resourceName : curCustomizedViews.keySet()) {
+        if (!resourceMap.keySet().contains(resourceName)) {
+          LogUtil.logInfo(LOG, _eventId, "Remove customizedView for resource: " + resourceName);
+          dataAccessor.removeProperty(keyBuilder.customizedView(stateType, resourceName));
+          customizedViewToRemove.add(resourceName);
+        }
+      }
+      cache.removeCustomizedViews(stateType, customizedViewToRemove);
     }
   }