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

    https://github.com/apache/spark/pull/9428#discussion_r44355235
  
    --- Diff: core/src/test/scala/org/apache/spark/CheckpointSuite.scala ---
    @@ -251,6 +252,46 @@ class CheckpointSuite extends SparkFunSuite with 
LocalSparkContext with Logging
         assert(rdd.partitions.size === 0)
       }
     
    +  runTest("SPARK-8582: checkpointing should only launch one job") { 
reliableCheckpoint: Boolean =>
    +    @volatile var jobCounter = 0
    +    sc.addSparkListener(new SparkListener {
    +      override def onJobStart(jobStart: SparkListenerJobStart): Unit = {
    +        jobCounter += 1
    +      }
    +    })
    +    val rdd = sc.parallelize(1 to 100, 10)
    +    checkpoint(rdd, reliableCheckpoint)
    +    assert(rdd.collect() === (1 to 100))
    +    sc.listenerBus.waitUntilEmpty(10000)
    +    assert(jobCounter === 1)
    +  }
    +
    +  runTest("checkpointing without draining Iterators") { 
reliableCheckpoint: Boolean =>
    +    @volatile var jobCounter = 0
    +    sc.addSparkListener(new SparkListener {
    +      override def onJobStart(jobStart: SparkListenerJobStart): Unit = {
    +        jobCounter += 1
    +      }
    +    })
    +    val rdd = sc.parallelize(1 to 100, 10)
    +    checkpoint(rdd, reliableCheckpoint)
    +    assert(rdd.take(5) === (1 to 5))
    +    sc.listenerBus.waitUntilEmpty(10000)
    +    // Because `take(5)` only consumes the first partition, there should 
be another job to
    +    // checkpoint other partitions.
    +    assert(jobCounter === 2)
    +    assert(rdd.collect() === (1 to 100))
    +  }
    +
    +  runTest("call RDD.iterator lazily") { reliableCheckpoint: Boolean =>
    --- End diff --
    
    Just found a corner case for `CheckpointingIterator`. In this case, 
`CheckpointingIterator.complete` of `parCollection` will be called before 
`lazyRDD`'s. 
    
    I cannot find any solution for this case since we cannot run 
`CheckpointingIterator.complete`s in the correct order. Maybe we should revisit 
the approach of #9258


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to