HeartSaVioR commented on a change in pull request #26771: [SPARK-30143][SS] Add 
a timeout on stopping a streaming query
URL: https://github.com/apache/spark/pull/26771#discussion_r354642615
 
 

 ##########
 File path: 
sql/core/src/test/scala/org/apache/spark/sql/execution/streaming/MicroBatchExecutionSuite.scala
 ##########
 @@ -68,4 +84,74 @@ class MicroBatchExecutionSuite extends StreamTest with 
BeforeAndAfter {
       CheckNewAnswer((25, 1), (30, 1))   // This should not throw the error 
reported in SPARK-24156
     )
   }
+
+  test("SPARK-30143: stop waits until timeout if blocked") {
+    val latch = new CountDownLatch(1)
+    BlockOnStopSourceProvider.setLatch(latch)
+    val sq = 
spark.readStream.format(BlockOnStopSourceProvider.getClass.getName)
+      .load()
+      .writeStream
+      .format("console")
+      .start()
+    failAfter(60.seconds) {
+      val startTime = System.nanoTime()
+      withSQLConf(SQLConf.STREAMING_STOP_TIMEOUT.key -> "2000") {
+        intercept[TimeoutException] {
+          sq.stop()
+        }
+      }
+      val duration = (System.nanoTime() - startTime) / 1e6
+      assert(duration >= 2000 * 1e6,
+        s"Should have waiter more than 2000 millis, but waited $duration 
millis")
 
 Review comment:
   nit: waiter -> waited

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to