[ 
https://issues.apache.org/jira/browse/CASSANDRA-6682?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paulo Gaspar updated CASSANDRA-6682:
------------------------------------

    Attachment: 6682.txt

The attached files contains all necessary changes.

> Loss of precision under concurrent access on o.a.c.utils.EstimatedHistogram 
> methods
> -----------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-6682
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6682
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Paulo Gaspar
>            Priority: Minor
>             Fix For: 1.2.16, 2.0.6
>
>         Attachments: 6682.txt
>
>
> On method getBuckets(), under concurrent use of an instance, the value of a 
> "buckets" variable element might change between its access on the 1st for 
> cycle and its access on the 2nd, when it is reset to 0. This means that, if 
> one collects metrics by repeatedly calling estHist.getBuckets(true), (e.g.: 
> to sum its values) it will miss counting some values added to "buckets" 
> entries between that 1st and 2nd access.
> On method mean(), if the i-th entry of "buckets" changes value between the 
> 1st and 2nd access inside the for cycle, than the "elements" and "sum" 
> accumulators are not working with the same values for that entry. It is more 
> precise (and faster) to use a local variable to read the value just once.
> Not an error but a semantic improvement: at my initial read of this class, I 
> thought the "buckets" and "bucketOffsets" fields could change length. Such 
> perception can be avoided by making the "bucketOffsets" field final.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to