Skip to content

Commit 255b4fd

Browse files
committed
Updated test.
1 parent f9814d9 commit 255b4fd

File tree

3 files changed

+23
-44
lines changed

3 files changed

+23
-44
lines changed

core/src/test/scala/org/apache/spark/ExternalShuffleServiceSuite.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
package org.apache.spark
1919

20-
import java.util.concurrent.atomic.AtomicInteger
21-
2220
import org.scalatest.BeforeAndAfterAll
2321

2422
import org.apache.spark.network.TransportContext

core/src/test/scala/org/apache/spark/ShuffleFaultToleranceSuite.scala

Lines changed: 0 additions & 42 deletions
This file was deleted.

core/src/test/scala/org/apache/spark/ShuffleSuite.scala

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import org.scalatest.Matchers
2323
import org.apache.spark.ShuffleSuite.NonJavaSerializableClass
2424
import org.apache.spark.rdd.{CoGroupedRDD, OrderedRDDFunctions, RDD, ShuffledRDD, SubtractedRDD}
2525
import org.apache.spark.serializer.KryoSerializer
26+
import org.apache.spark.storage.{ShuffleDataBlockId, ShuffleBlockId}
2627
import org.apache.spark.util.MutablePair
2728

2829
abstract class ShuffleSuite extends FunSuite with Matchers with LocalSparkContext {
@@ -263,6 +264,28 @@ abstract class ShuffleSuite extends FunSuite with Matchers with LocalSparkContex
263264
}
264265
}
265266
}
267+
268+
test("[SPARK-4085] rerun map stage if reduce stage cannot find its local shuffle file") {
269+
val myConf = conf.clone().set("spark.test.noStageRetry", "false")
270+
sc = new SparkContext("local", "test", myConf)
271+
val rdd = sc.parallelize(1 to 10, 2).map((_, 1)).reduceByKey(_ + _)
272+
rdd.count()
273+
274+
// Delete one of the local shuffle blocks.
275+
val hashFile = sc.env.blockManager.diskBlockManager.getFile(new ShuffleBlockId(0, 0, 0))
276+
val sortFile = sc.env.blockManager.diskBlockManager.getFile(new ShuffleDataBlockId(0, 0, 0))
277+
assert(hashFile.exists() || sortFile.exists())
278+
279+
if (hashFile.exists()) {
280+
hashFile.delete()
281+
}
282+
if (sortFile.exists()) {
283+
sortFile.delete()
284+
}
285+
286+
// This count should retry the execution of the previous stage and rerun shuffle.
287+
rdd.count()
288+
}
266289
}
267290

268291
object ShuffleSuite {

0 commit comments

Comments
 (0)