Github user xuanyuanking commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r182307728
  
    --- Diff: 
core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala ---
    @@ -2399,6 +2399,50 @@ class DAGSchedulerSuite extends SparkFunSuite with 
LocalSparkContext with TimeLi
         }
       }
     
    +  /**
    +   * This tests the case where origin task success after speculative task 
got FetchFailed
    +   * before.
    +   */
    +  test("[SPARK-23811] FetchFailed comes before Success of same task will 
cause child stage" +
    +    " never succeed") {
    +    // Create 3 RDDs with shuffle dependencies on each other: rddA <--- 
rddB <--- rddC
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = 
mapOutputTracker)
    +    val shuffleDepB = new ShuffleDependency(rddB, new HashPartitioner(2))
    +
    +    val rddC = new MyRDD(sc, 2, List(shuffleDepB), tracker = 
mapOutputTracker)
    +
    +    submit(rddC, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task success
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self 
still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    --- End diff --
    
    Here we only need to mock the speculative task failed event came before 
success event, `makeCompletionEvent` with same taskSets's task can achieve such 
goal. This also use in `task events always posted in speculation / when stage 
is killed`.


---

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

Reply via email to