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

Sean Timm updated SOLR-539:
---------------------------

    Attachment: RequestHandlerBase-volatile-stats.patch

This patch marks numRequests, numErrors, and totalTime volatile.  It also 
changes the casting in the calculation of avgRequestsPerSecond.

> Statistics variable atomicity in RequestHandlerBase
> ---------------------------------------------------
>
>                 Key: SOLR-539
>                 URL: https://issues.apache.org/jira/browse/SOLR-539
>             Project: Solr
>          Issue Type: Bug
>          Components: highlighter, search, spellchecker, update
>    Affects Versions: 1.3
>            Reporter: Sean Timm
>            Priority: Minor
>         Attachments: RequestHandlerBase-volatile-stats.patch
>
>
> Writes are not atomic on longs unless they are volatile.   At a minimum, 
> numRequests, numErrors, and totalTime should be marked volatile.  More 
> correct, but higher overhead due to contention and synchronization would be 
> to use AtomicLong.
> There is a minor error in the calculation of avgRequestsPerSecond.  The first 
> operand of the denominator is cast to a float then has a long subtracted from 
> it, in effect casting both longs to floats then performing the subtraction.  
> It is better to do the subtraction as longs then cast to a float.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to