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



##########
File path: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala
##########
@@ -1767,8 +1772,15 @@ private[spark] class DAGScheduler(
 
           // TODO: mark the executor as failed only if there were lots of 
fetch failures on it
           if (bmAddress != null) {
-            val hostToUnregisterOutputs = if 
(env.blockManager.externalShuffleServiceEnabled &&
-              unRegisterOutputOnHostOnFetchFailure) {
+            val executorDecommissionedWithShuffleLost =
+              taskSchedulerImpl.flatMap(
+                
_.executorDecommissionedWithShuffleLost(bmAddress.executorId)).getOrElse(false)
+            // If we already know that this executor was decommissioned and 
the config is set
+            // we will eagerly mark all the output on this host to be lost. To 
avoid un-necessary
+            // repeated fetch failures by other executors.
+            val hostLost = env.blockManager.externalShuffleServiceEnabled &&

Review comment:
       nit: might be better to rewrite to `(... && ...) || ...`

##########
File path: core/src/main/scala/org/apache/spark/scheduler/DecommissionInfo.scala
##########
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.scheduler
+
+/**
+ * Provides more detail about a decommissioning event
+ * @param message human readable reason for why the decommissioning is 
happening
+ * @param workerAlsoDecommissioned whether the worker is being decommissioned 
too.

Review comment:
       nit: rename to `isWorkerDecommissioned` ?

##########
File path: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala
##########
@@ -1767,8 +1772,15 @@ private[spark] class DAGScheduler(
 
           // TODO: mark the executor as failed only if there were lots of 
fetch failures on it
           if (bmAddress != null) {
-            val hostToUnregisterOutputs = if 
(env.blockManager.externalShuffleServiceEnabled &&
-              unRegisterOutputOnHostOnFetchFailure) {
+            val executorDecommissionedWithShuffleLost =
+              taskSchedulerImpl.flatMap(

Review comment:
       This is kind of hacky, why not add a new API to TaskScheduler?

##########
File path: 
core/src/main/scala/org/apache/spark/scheduler/ExecutorLossReason.scala
##########
@@ -54,10 +54,11 @@ private [spark] object LossReasonPending extends 
ExecutorLossReason("Pending los
 /**
  * @param _message human readable loss reason
  * @param workerLost whether the worker is confirmed lost too (i.e. including 
shuffle service)
+ *                   Used to know whether the shuffle data is lost too.
  */
 private[spark]
-case class SlaveLost(_message: String = "Slave lost", workerLost: Boolean = 
false)
-  extends ExecutorLossReason(_message)
+case class SlaveLost(_message: String = "Slave lost", workerLost: Boolean = 
false,
+                     expected: Boolean = false) extends 
ExecutorLossReason(_message)

Review comment:
       please add comment to the new param, also is it good to rename to 
`causedByApp` ?

##########
File path: 
core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala
##########
@@ -911,13 +913,35 @@ private[spark] class TaskSchedulerImpl(
     }
   }
 
-  override def executorDecommission(executorId: String): Unit = {
+  override def executorDecommission(executorId: String,
+                                    decommissionInfo: DecommissionInfo): Unit 
= {
+    synchronized {
+      if (!executorsPendingDecommission.contains(executorId)) {
+        executorsPendingDecommission(executorId) = decommissionInfo
+      }
+    }
     rootPool.executorDecommission(executorId)
     backend.reviveOffers()
   }
 
-  override def executorLost(executorId: String, reason: ExecutorLossReason): 
Unit = {
+  def executorDecommissionedWithShuffleLost(executorId: String): 
Option[Boolean] = synchronized {
+    // If external shuffle service is enabled, then shuffle is lost when when 
we know the worker is

Review comment:
       nit: remove the duplicated "when"




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