Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redis-trib.rb reshard bug #2990

Open
weizijun opened this Issue Jan 7, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@weizijun
Copy link

weizijun commented Jan 7, 2016

Hi:
I find a bug from redis-trib.rb. The reshard cmd compute_reshard_table error,as you say:

    #2) We take one slot more from the first instance in the case of not
    #    perfect 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.

But if slots is 11, the 11th slot will not allocate.because of the algorithm:
n = (numslots.to_f/source_tot_slots*s.slots.length)
if i == 0
n = n.ceil
else
n = n.floor

Only the first node use ceil result in the bug.
this is the case:
ruby redis-trib.rb reshard --from all --to 80b661ecca260c89e3d8ea9b98f77edaeef43dcd --slots 11 10.180.157.199:6379

Performing Cluster Check (using node 10.180.157.199:6379)
S: b2506515b38e6bbd3034d540599f4cd2a5279ad1 10.180.157.199:6379
slots: (0 slots) slave
replicates 460b3a11e296aafb2615043291b7dd98274bb351
S: d376aaf80de0e01dde1f8cd4647d5ac3317a8641 10.180.157.205:6379
slots: (0 slots) slave
replicates e36c46dbe90960f30861af00786d4c2064e63df2
M: 15126fb33796c2c26ea89e553418946f7443d5a5 10.180.157.201:6379
slots:10923-16383 (5461 slots) master
1 additional replica(s)
S: 59fa6ee455f58a5076f6d6f83ddd74161fd7fb55 10.180.157.208:6379
slots: (0 slots) slave
replicates 15126fb33796c2c26ea89e553418946f7443d5a5
M: 460b3a11e296aafb2615043291b7dd98274bb351 10.180.157.202:6379
slots:0-5460 (5461 slots) master
1 additional replica(s)
M: 80b661ecca260c89e3d8ea9b98f77edaeef43dcd 10.180.157.200:6380
slots: (0 slots) master
0 additional replica(s)
M: e36c46dbe90960f30861af00786d4c2064e63df2 10.180.157.200:6379
slots:5461-10922 (5462 slots) master
1 additional replica(s)
[OK] All nodes agree about slots configuration.
Check for open slots...
Check slots coverage...
[OK] All 16384 slots covered.

Ready to move 11 slots.
Source nodes:
M: 15126fb33796c2c26ea89e553418946f7443d5a5 10.180.157.201:6379
slots:10923-16383 (5461 slots) master
1 additional replica(s)
M: 460b3a11e296aafb2615043291b7dd98274bb351 10.180.157.202:6379
slots:0-5460 (5461 slots) master
1 additional replica(s)
M: e36c46dbe90960f30861af00786d4c2064e63df2 10.180.157.200:6379
slots:5461-10922 (5462 slots) master
1 additional replica(s)
Destination node:
M: 80b661ecca260c89e3d8ea9b98f77edaeef43dcd 10.180.157.200:6380
slots: (0 slots) master
0 additional replica(s)
Resharding plan:
Moving slot 5461 from e36c46dbe90960f30861af00786d4c2064e63df2
Moving slot 5462 from e36c46dbe90960f30861af00786d4c2064e63df2
Moving slot 5463 from e36c46dbe90960f30861af00786d4c2064e63df2
Moving slot 5464 from e36c46dbe90960f30861af00786d4c2064e63df2
Moving slot 0 from 460b3a11e296aafb2615043291b7dd98274bb351
Moving slot 1 from 460b3a11e296aafb2615043291b7dd98274bb351
Moving slot 2 from 460b3a11e296aafb2615043291b7dd98274bb351
Moving slot 10923 from 15126fb33796c2c26ea89e553418946f7443d5a5
Moving slot 10924 from 15126fb33796c2c26ea89e553418946f7443d5a5
Moving slot 10925 from 15126fb33796c2c26ea89e553418946f7443d5a5
Do you want to proceed with the proposed reshard plan (yes/no)? yes
Moving slot 5461 from 10.180.157.200:6379 to 10.180.157.200:6380:
Moving slot 5462 from 10.180.157.200:6379 to 10.180.157.200:6380:
Moving slot 5463 from 10.180.157.200:6379 to 10.180.157.200:6380:
Moving slot 5464 from 10.180.157.200:6379 to 10.180.157.200:6380:
Moving slot 0 from 10.180.157.202:6379 to 10.180.157.200:6380:
Moving slot 1 from 10.180.157.202:6379 to 10.180.157.200:6380:
Moving slot 2 from 10.180.157.202:6379 to 10.180.157.200:6380:
Moving slot 10923 from 10.180.157.201:6379 to 10.180.157.200:6380:
Moving slot 10924 from 10.180.157.201:6379 to 10.180.157.200:6380:
Moving slot 10925 from 10.180.157.201:6379 to 10.180.157.200:6380:

@weizijun

This comment has been minimized.

Copy link
Author

weizijun commented Jan 7, 2016

redis-trib.rb is from redis 3.0.6 version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.