mustafaiman commented on a change in pull request #2215:
URL: https://github.com/apache/hive/pull/2215#discussion_r619450425



##########
File path: 
llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/TaskExecutorService.java
##########
@@ -971,11 +971,26 @@ private TaskWrapper 
getSuitableVictimFromPreemptionQueue(TaskWrapper candidate)
     }
   }
 
+  /**
+   * Victim Task (A) should be preempted in favor of a candidate Task (B) when:
+   *    1. A is NOT on the same DAG and Vertex as B  AND

Review comment:
       This comment confused me initially. I think "A is not on the same Vertex 
as B" is enough. Being in the same vertex implies being in the same DAG.

##########
File path: 
llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/TaskExecutorService.java
##########
@@ -971,11 +971,26 @@ private TaskWrapper 
getSuitableVictimFromPreemptionQueue(TaskWrapper candidate)
     }
   }
 
+  /**
+   * Victim Task (A) should be preempted in favor of a candidate Task (B) when:
+   *    1. A is NOT on the same DAG and Vertex as B  AND
+   *      1.1. B is a Guaranteed Task while A is not OR
+   *      1.2. Both are guaranteed but A is not finishable and B is
+   * To make sure that Victim task is not behind some upstream updates 
(asynchronous),
+   * we check its sources' state (by QueryFragmentInfo.canFinish method)
+   * @param candidate Task
+   * @param victim Task
+   * @return True when victim should be preempted in favor of candidate Task
+   */
   private static boolean canPreempt(TaskWrapper candidate, TaskWrapper victim) 
{
     if (victim == null) return false;
+    SignableVertexSpec candVrtx = 
candidate.getTaskRunnerCallable().getFragmentInfo().getVertexSpec();
+    SignableVertexSpec vicVrtx = 
victim.getTaskRunnerCallable().getFragmentInfo().getVertexSpec();
+    if (candVrtx.getHiveQueryId().compareTo(vicVrtx.getHiveQueryId()) == 0 &&

Review comment:
       candVrtx.getHiveQueryId()**.equals**(vicVrtx.getHiveQueryId()) is more 
clear i think.




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