viirya commented on a change in pull request #29014: URL: https://github.com/apache/spark/pull/29014#discussion_r459827811
########## File path: core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala ########## @@ -939,12 +941,40 @@ 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) + if (oldDecomInfo.isEmpty || !oldDecomInfo.get.isHostDecommissioned) { + executorsPendingDecommission(executorId) = decommissionInfo + } + } rootPool.executorDecommission(executorId) backend.reviveOffers() } - override def executorLost(executorId: String, reason: ExecutorLossReason): Unit = { + override def getExecutorDecommissionInfo(executorId: String) + : Option[ExecutorDecommissionInfo] = synchronized { + executorsPendingDecommission.get(executorId) + } + + override def executorLost(executorId: String, givenReason: ExecutorLossReason): Unit = { var failedExecutor: Option[String] = None + val reason = givenReason match { + // Handle executor process loss due to decommissioning + case ExecutorProcessLost(message, workerLost, causedByApp) => + val executorDecommissionInfo = getExecutorDecommissionInfo(executorId) + ExecutorProcessLost( + message, + // Also mark the worker lost if we know that the host was decommissioned + workerLost || executorDecommissionInfo.exists(_.isHostDecommissioned), Review comment: Oh I see. You're right. Is it possible any `ExecutorDecommissionInfo` come in after `ExecutorProcessLost`? If so, I think when we reach this, it's still possible the `ExecutorDecommissionInfo` with host decommission hasn't come in `executorsPendingDecommission` yet. In this case, we cannot mark worker lost correctly. And we cannot remove the `ExecutorDecommissionInfo` from `executorsPendingDecommission` too? ---------------------------------------------------------------- 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