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

Does migrating multiple keys with a single command call not supported in redis 4.0.10? #5765

Open
DFanny opened this Issue Jan 10, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@DFanny
Copy link

DFanny commented Jan 10, 2019

Does migrate not support batch migration keys in redis 4.0.10?Below is my test results in redis 4.0.10,including clusters and single instances:
in clusters,migrate multiple keys returns incorrect "moved" information or “CROSSSLOT Keys in request don't hash to the same slot”
[STG-T1REIMTA_C00:cnsh281551:5801:M ~]$r
127.0.0.1:5801> cluster nodes
c8d230ebea0db43a69a9fe3541fc41aa7b2ce106 30.10.0.33:5804@15804 master - 0 1547108120160 4 connected 9830-13105
486dac12f49a2c44832adfb0c20c93575c0dec4e 30.10.0.32:5803@15803 master - 0 1547108120000 3 connected 6554-9829
eebd5abbc61bf82bd38ba6bf54a227e0c5e9f62d 30.10.0.33:5802@15802 master - 0 1547108118157 2 connected 3277-6553
d04b2db154f157327f2f9c380cbdf66e81b133a0 30.10.0.32:5801@15801 myself,master - 0 1547108119000 1 connected 0-3276
1bf5f64c69b3ec7699991d8a303447b25f5295c7 30.10.0.32:5805@15805 master - 0 1547108119000 5 connected 13106-16383
127.0.0.1:5801> exit

[STG-T1REIMTA_C00:cnsh281551:5801:M ~]$redis-cli -p 5802 -h 30.10.0.33 -a passwordxx
30.10.0.33:5802> cluster setslot importing d04b2db154f157327f2f9c380cbdf66e81b133a0
(error) ERR Invalid or out of range slot
30.10.0.33:5802> cluster setslot 0 importing d04b2db154f157327f2f9c380cbdf66e81b133a0
OK
30.10.0.33:5802> exit
[STG-T1REIMTA_C00:cnsh281551:5801:M ~]$r
127.0.0.1:5801> cluster setslot 0 migrating
[STG-T1REIMTA_C00:cnsh281551:5801:M ~]$redis-cli -p 5801 -h 30.10.0.32 -a passwordxx
30.10.0.32:5801> cluster setslot 0 migrating eebd5abbc61bf82bd38ba6bf54a227e0c5e9f62d
OK
30.10.0.32:5801> cluster nodes
c8d230ebea0db43a69a9fe3541fc41aa7b2ce106 30.10.0.33:5804@15804 master - 0 1547108288000 4 connected 9830-13105
486dac12f49a2c44832adfb0c20c93575c0dec4e 30.10.0.32:5803@15803 master - 0 1547108289000 3 connected 6554-9829
eebd5abbc61bf82bd38ba6bf54a227e0c5e9f62d 30.10.0.33:5802@15802 master - 0 1547108289429 2 connected 3277-6553
d04b2db154f157327f2f9c380cbdf66e81b133a0 30.10.0.32:5801@15801 myself,master - 0 1547108287000 1 connected 0-3276 [0->-eebd5abbc61bf82bd38ba6bf54a227e0c5e9f62d]
1bf5f64c69b3ec7699991d8a303447b25f5295c7 30.10.0.32:5805@15805 master - 0 1547108287000 5 connected 13106-16383
30.10.0.32:5801> exit
[STG-T1REIMTA_C00:cnsh281551:5801:M ~]$redis-cli -p 5802 -h 30.10.0.33 -a passwordxx
30.10.0.33:5802> cluster nodes
486dac12f49a2c44832adfb0c20c93575c0dec4e 30.10.0.32:5803@15803 master - 0 1547108295000 3 connected 6554-9829
d04b2db154f157327f2f9c380cbdf66e81b133a0 30.10.0.32:5801@15801 master - 0 1547108294000 1 connected 0-3276
eebd5abbc61bf82bd38ba6bf54a227e0c5e9f62d 30.10.0.33:5802@15802 myself,master - 0 1547108293000 2 connected 3277-6553 [0-<-d04b2db154f157327f2f9c380cbdf66e81b133a0]
c8d230ebea0db43a69a9fe3541fc41aa7b2ce106 30.10.0.33:5804@15804 master - 0 1547108293000 4 connected 9830-13105
1bf5f64c69b3ec7699991d8a303447b25f5295c7 30.10.0.32:5805@15805 master - 0 1547108295406 5 connected 13106-16383
30.10.0.33:5802> exit
[STG-T1REIMTA_C00:cnsh281551:5801:M ~]$redis-cli -p 5801 -h 30.10.0.32 -a passwordxx
30.10.0.32:5801> cluster getkeysinslot 0 10

  1. "264582\xc2\xa7013906992438"
  2. "282309\xc2\xa7017363367325"
  3. "283090\xc2\xa7013335718795"
  4. "283090\xc2\xa7015158268488"
  5. "29000216\xc2\xa7015077071006"
  6. "29000417\xc2\xa7013757638850"
  7. "29000624\xc2\xa7013566508091"
  8. "29001369\xc2\xa7018955533036"
  9. "29001530\xc2\xa7015279269553"
  10. "29001705\xc2\xa7013541088010"
    30.10.0.32:5801> migrate 30.10.0.33 5802 " " 0 60 REPLACE KEYS "264582\xc2\xa7013906992438" auth passwordxx
    (error) MOVED 9314 30.10.0.32:5803
    30.10.0.32:5801> type "264582\xc2\xa7013906992438"
    hash
    30.10.0.32:5801> hlen "264582\xc2\xa7013906992438"
    (integer) 4
    30.10.0.32:5801> exit
    [STG-T1REIMTA_C00:cnsh281551:5801:M ~]$redis-cli -p 5803 -h 30.10.0.32 -a passwordxx
    30.10.0.32:5803> type "264582\xc2\xa7013906992438"
    (error) MOVED 0 30.10.0.32:5801
    30.10.0.32:5803> exit
    [STG-T1REIMTA_C00:cnsh281551:5801:M ~]$redis-cli -p 5801 -h 30.10.0.32 -a passwordxx
    30.10.0.32:5801> migrate 30.10.0.33 5802 "264582\xc2\xa7013906992438" 0 60 REPLACE auth passwordxx
    OK
    30.10.0.32:5801> type "264582\xc2\xa7013906992438"
    (error) ASK 0 30.10.0.33:5802
    30.10.0.32:5801>

And,in single instance,I got the error of NOAUTH,but ,only migrate one key,that is ok
30.10.0.31:5705> migrate 30.10.0.33 5579 hello 0 60 COPY auth passwordxxx
OK
30.10.0.31:5705> migrate 30.10.0.33 5579 "" 0 600 KEYS hello TOKEN_NEBULA sex auth passwordxxx
(error) ERR Target instance replied with error: NOAUTH Authentication required.
30.10.0.31:5705>

And, I tested in redis 3.2.0 ,it is ok to migrate single key or multiple keys :
127.0.0.1:5487> mset dfang_test test helloh world
OK
127.0.0.1:5487> migrate 30.10.0.33 5579 i1qJ_fSb~4 "" 0 600 KEYS dfang_test helloh
OK

30.10.0.33:5579> mget dfang_test helloh

  1. "test"
  2. "world"
    30.10.0.33:5579>

Why is this happening, is it a bug in 4.0.10?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment