[ 
https://issues.apache.org/jira/browse/CASSANDRA-12283?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15414028#comment-15414028
 ] 

Joshua McKenzie commented on CASSANDRA-12283:
---------------------------------------------

Not sure I follow the claim that the loop will not run for the correct amount 
of time. Reference:
{code:title=loop}
    public static void spinAssertEquals(Object expected, Supplier<Object> s, 
int timeoutInSeconds)
    {
        long now = System.currentTimeMillis();
        while (System.currentTimeMillis() - now < now + (1000 * 
timeoutInSeconds))
        {
            if (s.get().equals(expected))
                break;
            Thread.yield();
{code}
As {{now}} is set once and then referenced on subsequent iterations, that loop 
should continue as long as the {{current millis - start millis < start millis + 
timeout millis}}.

As for the Thread.yield part of things - I'm mostly neutral on it. It's not a 
correctness issue and, while theoretically the test could eat cycles designated 
for other tests or things, the entire premise is that it should yield in the 
scheduler during its quanta. As we only reference that method in unit tests, it 
doesn't seem like that would be the issue.

> CommitLogSegmentManagerTest.testCompressedCommitLogBackpressure is flaky
> ------------------------------------------------------------------------
>
>                 Key: CASSANDRA-12283
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12283
>             Project: Cassandra
>          Issue Type: Test
>            Reporter: Joshua McKenzie
>            Assignee: Benjamin Lerer
>            Priority: Minor
>              Labels: unittest
>
> Failed 3 of the last 38 runs.
> [Failure|http://cassci.datastax.com/job/cassandra-3.9_testall/lastCompletedBuild/testReport/org.apache.cassandra.db.commitlog/CommitLogSegmentManagerTest/testCompressedCommitLogBackpressure/]
> Details:
> Error Message
> Timeout occurred. Please note the time in the report does not reflect the 
> time until the timeout.
> Stacktrace
> junit.framework.AssertionFailedError: Timeout occurred. Please note the time 
> in the report does not reflect the time until the timeout.
>       at java.lang.Thread.run(Thread.java:745)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to