Github user jiajunwang commented on a diff in the pull request:

    https://github.com/apache/helix/pull/88#discussion_r117420922
  
    --- 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 think even the task is not re-scheduled, the information will be removed 
after cancel, right?
    So there shouldn't be the case that the context is RUNNING but the task is 
dropped. Unless something wrong happens during cancellation. In which case, 
showing RUNNING is correct.


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

Reply via email to