OPP#describeOwnership reports incorrect ownership
-------------------------------------------------

                 Key: CASSANDRA-2800
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2800
             Project: Cassandra
          Issue Type: Bug
    Affects Versions: 0.7.4
            Reporter: Jon Hermes
            Assignee: Jon Hermes
            Priority: Minor
             Fix For: 0.7.7, 0.8.2
         Attachments: 2800.txt

OPP#describeOwnership relies on StorageService#getSplits and counts the 
received tokens as its basis of ownership.

When the number of result keys is less than the number of splits, the full 
count is omitted (to save work?). However, we don't care if a split would end 
up fractional in this case, we just need the full count.

The logic here is:
{code}
int splits = keycount * DatabaseDescriptor.getIndexInterval() / keysPerSplit;
if (keycount >= splits) { ... add count to result set }
{code}
We were passing in 1 key per split (since we just care about the count), but 
splits=keycount*IndexInterval is guaranteed to be > keycount, so the result set 
is not completely formed.
The better "unit keysPerSplit" to use is IndexInterval itself, which gives 
splits=keycount*II/II=keycount, so the logic runs correctly.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to