From d75ab87226cfaf80a6aa83c7ec9fe9a55316984d Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 7 Nov 2013 16:12:06 +0100 Subject: [PATCH] redis-trib: fixed slot allocation when --replicas is used. --- src/redis-trib.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/redis-trib.rb b/src/redis-trib.rb index b6bf2980..b9a9ee60 100755 --- a/src/redis-trib.rb +++ b/src/redis-trib.rb @@ -517,10 +517,10 @@ class RedisTrib # Alloc slots on masters i = 0 - masters.each{|n| + masters.each_with_index{|n,masternum| first = i*slots_per_node last = first+slots_per_node-1 - last = ClusterHashSlots-1 if i == @nodes.length-1 + last = ClusterHashSlots-1 if masternum == masters.length-1 n.add_slots first..last i += 1 }