Github user squito commented on a diff in the pull request: https://github.com/apache/spark/pull/5636#discussion_r35692889 --- Diff: core/src/main/scala/org/apache/spark/scheduler/Stage.scala --- @@ -76,6 +76,37 @@ private[spark] abstract class Stage( */ private var _latestInfo: StageInfo = StageInfo.fromStage(this, nextAttemptId) + /** + * Spark is resilient to executors dying by retrying stages on FetchFailures. Here, we keep track + * of unique stage failures (per stage attempt) triggered by fetch failures to prevent endless + * stage retries. Specifically, per stage we wish to only record a failure when the following + * holds: + * + * A) A fetch failure was observed + * B) A failure has not yet been registered for this stage attempt. There may be multiple + * concurrent failures for a sinlge stage since we may have multiple tasks executing at the same + * time, one or many of which may fail. Also, even though there may only be one non-zombie stage + * attemp, zombie stages may still have running tasks. + */ + private val attemptsFailedFromFetch = new HashSet[Int] + + private[scheduler] def clearFailures() : Unit = { + attemptsFailedFromFetch.clear() + } + + /** + * Check whether we should abort the failedStage due to multiple failures. + * This method updates the running set of failures for a particular stage and returns + * true if the number of failures exceeds the allowable number of failures. + */ + private[scheduler] def failAndShouldAbort(task: Task[_]): Boolean = { + // We increment the failure count on the first attempt for a particular Stage + attemptsFailedFromFetch.add(task.stageAttemptId) + // Check for multiple FetchFailures in a Stage and for the stage failing repeatedly following + // resubmissions. + attemptsFailedFromFetch.size >= Stage.MAX_STAGE_FAILURES --- End diff -- I think both of these comments inside this method can probably now be deleted. The first comment isn't accurate any more (we don't count the first failed attempt of a particular stage, we just count attempts per stage). And I don't the second one really adds much over the scaladoc.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org