forked from basho/riak_core
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Default to v2 claim, update QC tests, fix bug in select_indices
1. The new default claim is now set to v2. 2. The semantics of wants_claim changed so I had to update the wants_claim test. Essentially the old wants_claim was simply an idicator if the ring is inbalanced at all and would return `{yes,0}` if it is. The new wants_claim is more true to the name in that it return `{yes,N}` meaning the node would like to calim `N` partitions. 3. Based on the unique nodes property there was an edge case in the situation where there is 16 partitions and 15 nodes. I'm not sure if this edge case would appear in other situations. Anyways, the way select_indices was written when the 15th node would go to claim it would determine that there was no safe partition it could claim and then would perform a rebalance (diagonalize). However a rebalance doesn't make any guarentee about keeping the target_n invariant on wrap around. So you would end up with the last and first partition being owned by the same node. The problem was that select_indies assumed that the first owner could give up it's partition `First = (LastNth =:= Nth)` but that wouldn't hold true and then no other partition could be claimed because they would all be within target_n of the LastNth/FirstNth. My change is to pass an explicit flag in the accumulator that represents whether or not the node has claimed anything yet. This makes, the possibly incorrect, assumption that the node never currently owns anything when `select_indices` is called. I was able to get a 500K iteration of the QC prop to pass but I do wonder if things could be different in production. After talking with Joe he seemed to think the change was safe.
- Loading branch information
Showing
1 changed file
with
218 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters