[
https://issues.apache.org/jira/browse/CASSANDRA-16236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17309517#comment-17309517
]
Andres de la Peña commented on CASSANDRA-16236:
-----------------------------------------------
It's not easy to reproduce the problem but it can be done adding calls to
{{Thread.sleep}} before [this call to
{{System.currentTimeMillis}}|https://github.com/apache/cassandra/blob/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableMetadataTest.java#L97].
The cause of the problem is in [this call to
{{assertEquals}}|https://github.com/apache/cassandra/blob/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableMetadataTest.java#L102].
Since the compared timestamps and the delta are integers
{{Assert.assertEquals(float, float, float)}} is used. The int timestamps are
casted to floats and, since they have relatively high values, the loss of
precision of the cast can make the comparison to fail. For example, while
debugging I have seen a run where the compared timestamps were 1616771139 and
1616771129. They are inside the max allowed delta of ten seconds, but the
difference between their float values is higher than that (1616771139f -
1616771129f = 128.0).
[The proposed PR|https://github.com/apache/cassandra/pull/942] just forces the
use of {{Assert.assertEquals(double, double, double)}} instead of
{{Assert.assertEquals(float, float, float)}}, which should give us enough
precision.
CI results:
* [CircleCI
j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/241/workflows/12960670-589d-41b2-a08f-6d28796bec35]
* [CircleCI
j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/241/workflows/09114f17-1a5f-479a-8b06-916ba2aa1246]
> Fix flaky testTrackMaxDeletionTime
> ----------------------------------
>
> Key: CASSANDRA-16236
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16236
> Project: Cassandra
> Issue Type: Bug
> Components: Test/unit
> Reporter: Brandon Williams
> Assignee: Andres de la Peña
> Priority: Normal
> Fix For: 4.0-rc
>
> Attachments: Screenshot 2021-03-23 at 20.12.18.png
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> *
> testTrackMaxDeletionTime - org.apache.cassandra.io.sstable.SSTableMetadataTest
>
> junit.framework.AssertionFailedError: expected:<1.6038784E9> but
> was:<1.60387827E9>
> at
> org.apache.cassandra.io.sstable.SSTableMetadataTest.testTrackMaxDeletionTime(SSTableMetadataTest.java:102)
> https://app.circleci.com/pipelines/github/bereng/cassandra/160/workflows/6cb80410-b398-477c-b4c9-cc7369785869/jobs/1317
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]