You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Paulo Gaspar (JIRA)" <ji...@apache.org> on 2014/02/09 22:18:20 UTC
[jira] [Created] (CASSANDRA-6682) Loss of precision under
concurrent access on o.a.c.utils.EstimatedHistogram methods
Paulo Gaspar created CASSANDRA-6682:
---------------------------------------
Summary: 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
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)