Description
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:
int splits = keycount * DatabaseDescriptor.getIndexInterval() / keysPerSplit; if (keycount >= splits) { ... add count to result set }
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.