alirezazamani commented on a change in pull request #1006:
URL: https://github.com/apache/helix/pull/1006#discussion_r429367474



##########
File path: helix-core/src/main/java/org/apache/helix/task/RuntimeJobDag.java
##########
@@ -145,9 +145,21 @@ public boolean finishJob(String job) {
           String.format("Job: %s has either finished already, never been 
scheduled, or been removed from DAG", job));
     }
     // Add finished job's successors to ready-list
+
+    // If it is a jobQueue, there should be a check to make sure that the a 
job has not been added
+    // to the _readyJobList multiple times. This check is necessary because 
once the controller
+    // switch happens, the _readyJobList and _inflightJobList will be created 
from scratch. In this
+    // case, since there might be many jobs that have been finished before, we 
do not want to have a
+    // job several times to the _readyJobList. If _readyJobList has multiple 
instances of the same
+    // job, it can compromise the functionality of the parallel jobs.

Review comment:
       Without the fix:
   Please note the we add job to the _readyJob list once we call finishJob 
(once a job is completed).
   Let's say controller switch happened and we started from scratch.
   We have [Job0, Job1 , Job2] in the _readyList.
   To schedule the jobs, we get next job from readyList (Job0), see that this 
job is completed, we add the children of Job0 which is Job1. Hence the 
_readyList will be [Job1, Job2, Job1]. That is why we have same job added to 
the _readyList.
   
   In conclusion, if a job is finished and controller adds a wrong job, the 
_readyJobList will fall behind. For example in my test, we add Job4 multiple 
times. Since Job4 goes to in-progress state and it takes some time to finish, 
we do not add new job (i.e. job5) until Job4 is finished and hence we do not 
run jobs in parallel if this happens.




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

Reply via email to