HeartSaVioR opened a new pull request #25862: [SPARK-23197][STREAMING] Fix 
ReceiverSuite."receiver_life_cycle" to not rely on timing
URL: https://github.com/apache/spark/pull/25862
 
 
   ### What changes were proposed in this pull request?
   
   This patch changes ReceiverSuite."receiver_life_cycle" to record actual 
calls with timestamp in FakeReceiver/FakeReceiverSupervisor, which doesn't rely 
on timing of stopping and starting receiver in restarting receiver.
   
   ### Why are the changes needed?
   
   The test is flaky without this patch. We increased timeout to fix flakyness 
of this test 
(https://github.com/apache/spark/commit/15adcc8273e73352e5e1c3fc9915c0b004ec4836)
 but even with longer timeout it has been still failing intermittently.
   
   ### Does this PR introduce any user-facing change?
   
   No
   
   ### How was this patch tested?
   
   I've reproduced test failure artificially via below diff:
   
   ```
   diff --git 
a/streaming/src/main/scala/org/apache/spark/streaming/receiver/ReceiverSupervisor.scala
 
b/streaming/src/main/scala/org/apache/spark/streaming/receiver/ReceiverSupervisor.scala
   index faf6db82d5..d8977543c0 100644
   --- 
a/streaming/src/main/scala/org/apache/spark/streaming/receiver/ReceiverSupervisor.scala
   +++ 
b/streaming/src/main/scala/org/apache/spark/streaming/receiver/ReceiverSupervisor.scala
   @@ -191,9 +191,11 @@ private[streaming] abstract class ReceiverSupervisor(
          // thread pool.
          logWarning("Restarting receiver with delay " + delay + " ms: " + 
message,
            error.getOrElse(null))
   +      Thread.sleep(1000)
          stopReceiver("Restarting receiver with delay " + delay + "ms: " + 
message, error)
          logDebug("Sleeping for " + delay)
          Thread.sleep(delay)
   +      Thread.sleep(1000)
          logInfo("Starting receiver again")
          startReceiver()
          logInfo("Receiver started again")
   ```
   
   and confirmed this patch doesn't fail with the change.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to