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

Jonathan Ellis updated CASSANDRA-7183:
--------------------------------------

    Fix Version/s: 2.1 rc1

> BackgroundActivityMonitor.readAndCompute only returns half of the values
> ------------------------------------------------------------------------
>
>                 Key: CASSANDRA-7183
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7183
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Dave Brosius
>            Assignee: Dave Brosius
>            Priority: Minor
>             Fix For: 2.0.9, 2.1 rc1
>
>         Attachments: 7183.txt
>
>
> BackgroundActivityMonitor.readAndCompute does
> {code}
>         long[] returned = new long[tokenizer.countTokens()];
>         for (int i = 0; i < tokenizer.countTokens(); i++)
>             returned[i] = Long.parseLong(tokenizer.nextToken());
> {code}
> which is not only inefficient as it counts tokens each time thru the loop, 
> it's wrong in that only the first half of the values are populated in the 
> array, as each time thru the loop the number of tokens goes down by 1, since 
> you've consumed one.
> switch the loop to
> {code}
>  for (int i = 0; i < returned.length; i++)
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to