jiajunwang commented on a change in pull request #336: #334 Fix invoke
rebalance by "touching" IdealState/ResourceConfig
URL: https://github.com/apache/helix/pull/336#discussion_r303739444
##########
File path: helix-core/src/main/java/org/apache/helix/task/TaskUtil.java
##########
@@ -1021,11 +1021,21 @@ public static void purgeExpiredJobs(String workflow,
WorkflowConfig workflowConf
// concurrent write issue. It is possible that jobs got purged but
there is no event to
// trigger the pipeline to clean context.
HelixDataAccessor accessor = manager.getHelixDataAccessor();
- List<String> resourceConfigs =
- accessor.getChildNames(accessor.keyBuilder().resourceConfigs());
+ List<ResourceConfig> resourceConfigs =
+ accessor.getChildValues(accessor.keyBuilder().resourceConfigs());
if (resourceConfigs.size() > 0) {
-
RebalanceScheduler.invokeRebalanceForResourceConfig(manager.getHelixDataAccessor(),
- resourceConfigs.get(0));
+ // Only touch workflow configs to minimize the risk of messing up
regular resource config
+ // Also if there is no workflow configs, it is not necessary to
trigger a rebalance for that.
+ for (ResourceConfig resourceConfig : resourceConfigs) {
+ try {
+ WorkflowConfig config =
WorkflowConfig.fromHelixProperty(resourceConfig);
+
RebalanceScheduler.invokeRebalanceForResourceConfig(manager.getHelixDataAccessor(),
+ config.getWorkflowId());
+ break;
+ } catch (IllegalArgumentException ex) {
Review comment:
Can we have a better way to check the config type?
If there is a WorkflowConfig with an illegal argument, this logic won't be
able to tell the difference.
----------------------------------------------------------------
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]
With regards,
Apache Git Services