GitHub user JoshRosen opened a pull request:

    https://github.com/apache/spark/pull/3801

    [SPARK-1600] Refactor FileInputStream tests to remove Thread.sleep() calls 
and SystemClock usage

    This PR refactors Spark Streaming's FileInputStream tests to remove uses of 
Thread.sleep() and SystemClock, which should hopefully resolve some 
longstanding flakiness in these tests (see SPARK-1600).
    
    Key changes:
    
    - Modify FileInputDStream to use the scheduler's Clock instead of 
System.currentTimeMillis(); this allows it to be tested using ManualClock.
    - Fix a synchronization issue in ManualClock's `currentTime` method.
    - Add a StreamingTestWaiter class which allows callers to block until a 
certain number of batches have finished.
    - Change the FileInputStream tests so that files' modification times are 
manually set based off of ManualClock; this eliminates many Thread.sleep calls.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/JoshRosen/spark SPARK-1600

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/3801.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #3801
    
----
commit a95ddc41f2b10b57fa18e75c865d7ef4507cd771
Author: Josh Rosen <[email protected]>
Date:   2014-12-16T08:50:01Z

    Modify FileInputDStream to use Clock class.

commit 3c3efc3f75521020f482d56b41465a6373448cf5
Author: Josh Rosen <[email protected]>
Date:   2014-12-17T01:40:35Z

    Synchronize `currentTime` in ManualClock

commit dda1403f3eaabe9125b87ac45ac3e7b0d667e9de
Author: Josh Rosen <[email protected]>
Date:   2014-12-25T09:03:00Z

    Add StreamingTestWaiter class.

commit d4f2d87729b20f1060d456a6074f2da6a4e79cb3
Author: Josh Rosen <[email protected]>
Date:   2014-12-25T09:03:54Z

    Refactor file input stream tests to not rely on SystemClock.

commit c8f06b10431c555dab3be461622d5d96aa807685
Author: Josh Rosen <[email protected]>
Date:   2014-12-25T10:14:06Z

    Remove Thread.sleep calls in FileInputStream CheckpointSuite test.
    
    Hopefully this will fix SPARK-1600.

----


---
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