From 8290004d94760c22d6d3ca8dda3003ac8644422f Mon Sep 17 00:00:00 2001 From: Shixiong Zhu Date: Sat, 5 Mar 2016 15:26:27 -0800 Subject: [PATCH] [SPARK-13693][STREAMING][TESTS] Stop StreamingContext before deleting checkpoint dir ## What changes were proposed in this pull request? Stop StreamingContext before deleting checkpoint dir to avoid the race condition that deleting the checkpoint dir and writing checkpoint happen at the same time. The flaky test log is here: https://amplab.cs.berkeley.edu/jenkins/job/spark-master-test-sbt-hadoop-2.7/256/testReport/junit/org.apache.spark.streaming/MapWithStateSuite/_It_is_not_a_test_/ ## How was this patch tested? unit tests Author: Shixiong Zhu Closes #11531 from zsxwing/SPARK-13693. --- .../scala/org/apache/spark/streaming/MapWithStateSuite.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streaming/src/test/scala/org/apache/spark/streaming/MapWithStateSuite.scala b/streaming/src/test/scala/org/apache/spark/streaming/MapWithStateSuite.scala index b6d6585bd8..403400904b 100644 --- a/streaming/src/test/scala/org/apache/spark/streaming/MapWithStateSuite.scala +++ b/streaming/src/test/scala/org/apache/spark/streaming/MapWithStateSuite.scala @@ -43,10 +43,10 @@ class MapWithStateSuite extends SparkFunSuite } after { + StreamingContext.getActive().foreach { _.stop(stopSparkContext = false) } if (checkpointDir != null) { Utils.deleteRecursively(checkpointDir) } - StreamingContext.getActive().foreach { _.stop(stopSparkContext = false) } } override def beforeAll(): Unit = { -- GitLab