Github user kongweihan commented on a diff in the pull request: https://github.com/apache/helix/pull/88#discussion_r117837530 --- Diff: helix-core/src/main/java/org/apache/helix/task/JobRebalancer.java --- @@ -455,6 +454,44 @@ private ResourceAssignment computeResourceMapping(String jobResource, return ra; } + /** + * If assignment is different from previous assignment, drop the old running task if it's no + * longer assigned to the same instance, but not removing it from excludeSet because the same task + * should not be assigned to the new instance right way. + */ + private void dropRebalancedRunningTasks(Map<String, SortedSet<Integer>> newAssignment, + Map<String, SortedSet<Integer>> oldAssignment, Map<Integer, PartitionAssignment> paMap, + JobContext jobContext) { + for (String instance : oldAssignment.keySet()) { + for (Integer pId : oldAssignment.get(instance)) { + if (jobContext.getPartitionState(pId) == TaskPartitionState.RUNNING + && !newAssignment.get(instance).contains(pId)) { + paMap.put(pId, new PartitionAssignment(instance, TaskPartitionState.DROPPED.name())); + jobContext.setPartitionState(pId, TaskPartitionState.DROPPED); --- End diff -- I didn't see it gets updated. In the original code, if the CurrentState is null, it will throw exception at line 287.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---