GitHub user brkyvz opened a pull request:

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

    [SPARK-11791] Fix flaky test in BatchedWriteAheadLogSuite

    stack trace of failure:
    ```
    org.scalatest.exceptions.TestFailedDueToTimeoutException: The code passed 
to eventually never returned normally. Attempted 62 times over 1.006322071 
seconds. Last failure message: 
    Argument(s) are different! Wanted:
    writeAheadLog.write(
        java.nio.HeapByteBuffer[pos=0 lim=124 cap=124],
        10
    );
    -> at 
org.apache.spark.streaming.util.BatchedWriteAheadLogSuite$$anonfun$23$$anonfun$apply$mcV$sp$15.apply(WriteAheadLogSuite.scala:518)
    Actual invocation has different arguments:
    writeAheadLog.write(
        java.nio.HeapByteBuffer[pos=0 lim=124 cap=124],
        10
    );
    -> at 
org.apache.spark.streaming.util.WriteAheadLogSuite$BlockingWriteAheadLog.write(WriteAheadLogSuite.scala:756)
    ```
    
    I believe the issue was that due to a race condition, the ordering of the 
events could be messed up in the final ByteBuffer, therefore the comparison 
fails.
    
    By adding eventually between the requests, we make sure the ordering is 
preserved. Note that in real life situations, the ordering across threads will 
not matter.
    
    Another solution would be to implement a custom mockito matcher that sorts 
and then compares the results, but that kind of sounds like overkill to me. Let 
me know what you think @tdas @zsxwing 

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

    $ git pull https://github.com/brkyvz/spark fix-flaky-2

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

    https://github.com/apache/spark/pull/9790.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 #9790
    
----
commit 7992777607e4b12c511edeae8faf2eaed92ba0fe
Author: Burak Yavuz <[email protected]>
Date:   2015-11-18T03:52:29Z

    order events

----


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