attilapiros commented on a change in pull request #29014:
URL: https://github.com/apache/spark/pull/29014#discussion_r459924690



##########
File path: 
core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala
##########
@@ -939,12 +941,43 @@ private[spark] class TaskSchedulerImpl(
 
   override def executorDecommission(
       executorId: String, decommissionInfo: ExecutorDecommissionInfo): Unit = {
+    synchronized {
+      // The scheduler can get multiple decommission updates from multiple 
sources,
+      // and some of those can have isHostDecommissioned false. We merge them 
such that
+      // if we heard isHostDecommissioned ever true, then we keep that one 
since it is
+      // most likely coming from the cluster manager and thus authoritative
+      val oldDecomInfo = executorsPendingDecommission.get(executorId)
+      // Don't bother noting decommissioning for executors that don't have 
running tasks
+      // to prevent a race where the `executorDecommission` can be called 
after `removeExecutor`
+      if (executorIdToRunningTaskIds.contains(executorId) &&

Review comment:
       1) I think avoiding the above with 
`executorIdToRunningTaskIds.contains(executorId)` assumes to much knowledge 
about the interactions behind.
   
   **What about just checking whether the `executorId` is contained in 
`executorIdToHost`?**
   
   I think that is more straightforward: removed executors will be sooner or 
latter will be cleaned from the `executorIdToHost`:
   
https://github.com/apache/spark/blob/2ebfaccd7710e4152ccb73abfe91ecddf694356d/core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala#L1072
   
   If the `LossReasonPending` that just mean latter:
   
https://github.com/apache/spark/blob/2ebfaccd7710e4152ccb73abfe91ecddf694356d/core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala#L991-L993
   
   2) Move this condition up: we do not need the `oldDecomInfo` when the 
executor is already removed.
   




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to