mirror of
https://github.com/fluencelabs/redis
synced 2025-03-17 16:10:50 +00:00
redis-trib: fix for a slot allocation bug.
This commit is contained in:
parent
2b9ce0192e
commit
dd9ad57062
@ -319,10 +319,11 @@ class RedisTrib
|
||||
# divisibility. Like we have 3 nodes and need to get 10 slots, we take
|
||||
# 4 from the first, and 3 from the rest. So the biggest is always the first.
|
||||
sources = sources.sort{|a,b| b.slots.length <=> a.slots.length}
|
||||
source_tot_slots = sources.inject {|a,b| a.slots.length+b.slots.length}
|
||||
sources.each_with_index{|s,i|
|
||||
# Every node will provide a number of slots proportional to the
|
||||
# slots it has assigned.
|
||||
n = (numslots.to_f/4096*s.slots.length)
|
||||
n = (numslots.to_f/source_tot_slots*s.slots.length)
|
||||
if i == 0
|
||||
n = n.ceil
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user