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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]