You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2020/08/06 20:21:00 UTC

[GitHub] [helix] zhangmeng916 opened a new pull request #1225: Update customized view after all calculation is done

zhangmeng916 opened a new pull request #1225:
URL: https://github.com/apache/helix/pull/1225


   ### Issues
   
   - [X] My PR addresses the following Helix issues and references them in the PR description:
   
   fixed #1224 
   
   ### Description
   
   - [X] Here are some details about my PR, including screenshots of any UI changes:
   
   This PR changes one parenthesis to avoid updating customized view after each calculation. Instead, it will only update the customized view in zk and cache after calculation is done for all resources.
   
   ### Tests
   
   - [ ] The following tests are written for this issue:
   
   (List the names of added unit/integration tests)
   
   - [ ] The following is the result of the "mvn test" command on the appropriate module:
   
   (Before CI test pass, please copy & paste the result of "mvn test")
   
   ### Documentation (Optional)
   
   - In case of new functionality, my PR adds documentation in the following wiki page:
   
   (Link the GitHub wiki you added)
   
   ### Commits
   
   - My commits all reference appropriate Apache Helix GitHub issues in their subject lines. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   
   ### Code Quality
   
   - My diff has been formatted using helix-style.xml 
   (helix-style-intellij.xml if IntelliJ IDE is used)
   


----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] mgao0 commented on a change in pull request #1225: Update customized view after all calculation is done

Posted by GitBox <gi...@apache.org>.
mgao0 commented on a change in pull request #1225:
URL: https://github.com/apache/helix/pull/1225#discussion_r466727667



##########
File path: helix-core/src/main/java/org/apache/helix/controller/stages/CustomizedViewAggregationStage.java
##########
@@ -98,34 +98,34 @@ public void execute(final ClusterEvent event) throws Exception {
         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) {

Review comment:
       I'm not sure what HelixException you expect from this method? I think you could move this try and catch to the end of this method, since I could imagine some exceptions being thrown when updating to zk? computeCustomizedStateView is local computation so should be fine.




----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] zhangmeng916 commented on a change in pull request #1225: Update customized view after all calculation is done

Posted by GitBox <gi...@apache.org>.
zhangmeng916 commented on a change in pull request #1225:
URL: https://github.com/apache/helix/pull/1225#discussion_r466750923



##########
File path: helix-core/src/main/java/org/apache/helix/controller/stages/CustomizedViewAggregationStage.java
##########
@@ -98,34 +98,34 @@ public void execute(final ClusterEvent event) throws Exception {
         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) {

Review comment:
       The purpose is to keep the loop continue without stopping at a possible exception thrown by a resource. For the zk exceptions, we may not want to hide them. We will let them thrown out and stop the pipeline if necessary. 




----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] zhangmeng916 commented on pull request #1225: Update customized view after all calculation is done

Posted by GitBox <gi...@apache.org>.
zhangmeng916 commented on pull request #1225:
URL: https://github.com/apache/helix/pull/1225#issuecomment-670257741


   This PR is ready to be merged. Approved by @mgao0 and @jiajunwang 
   Final commit message:
   Update customized view after all calculation is done.
   


----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] jiajunwang merged pull request #1225: Update customized view after all calculation is done

Posted by GitBox <gi...@apache.org>.
jiajunwang merged pull request #1225:
URL: https://github.com/apache/helix/pull/1225


   


----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org