Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
00353f99
Commit
00353f99
authored
Dec 11, 2015
by
antirez
Browse files
MIGRATE: Fix key extraction for new form.
parent
f99be541
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/db.c
View file @
00353f99
...
@@ -1160,6 +1160,33 @@ int *sortGetKeys(struct redisCommand *cmd, robj **argv, int argc, int *numkeys)
...
@@ -1160,6 +1160,33 @@ int *sortGetKeys(struct redisCommand *cmd, robj **argv, int argc, int *numkeys)
return
keys
;
return
keys
;
}
}
int
*
migrateGetKeys
(
struct
redisCommand
*
cmd
,
robj
**
argv
,
int
argc
,
int
*
numkeys
)
{
int
i
,
num
,
first
,
*
keys
;
UNUSED
(
cmd
);
/* Assume the obvious form. */
first
=
3
;
num
=
1
;
/* But check for the extended one with the KEYS option. */
if
(
argc
>
6
)
{
for
(
i
=
6
;
i
<
argc
;
i
++
)
{
if
(
!
strcasecmp
(
argv
[
i
]
->
ptr
,
"keys"
)
&&
sdslen
(
argv
[
3
]
->
ptr
)
==
0
)
{
first
=
i
+
1
;
num
=
argc
-
first
;
break
;
}
}
}
keys
=
zmalloc
(
sizeof
(
int
)
*
num
);
for
(
i
=
0
;
i
<
num
;
i
++
)
keys
[
i
]
=
first
+
i
;
*
numkeys
=
num
;
return
keys
;
}
/* Slot to Key API. This is used by Redis Cluster in order to obtain in
/* Slot to Key API. This is used by Redis Cluster in order to obtain in
* a fast way a key that belongs to a specified hash slot. This is useful
* a fast way a key that belongs to a specified hash slot. This is useful
* while rehashing the cluster. */
* while rehashing the cluster. */
...
...
src/server.c
View file @
00353f99
...
@@ -264,7 +264,7 @@ struct redisCommand redisCommandTable[] = {
...
@@ -264,7 +264,7 @@ struct redisCommand redisCommandTable[] = {
{
"cluster"
,
clusterCommand
,
-
2
,
"ar"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"cluster"
,
clusterCommand
,
-
2
,
"ar"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"restore"
,
restoreCommand
,
-
4
,
"wm"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"restore"
,
restoreCommand
,
-
4
,
"wm"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"restore-asking"
,
restoreCommand
,
-
4
,
"wmk"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"restore-asking"
,
restoreCommand
,
-
4
,
"wmk"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"migrate"
,
migrateCommand
,
-
6
,
"w"
,
0
,
NULL
,
3
,
3
,
1
,
0
,
0
},
{
"migrate"
,
migrateCommand
,
-
6
,
"w"
,
0
,
migrateGetKeys
,
0
,
0
,
0
,
0
,
0
},
{
"asking"
,
askingCommand
,
1
,
"r"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"asking"
,
askingCommand
,
1
,
"r"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"readonly"
,
readonlyCommand
,
1
,
"rF"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"readonly"
,
readonlyCommand
,
1
,
"rF"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"readwrite"
,
readwriteCommand
,
1
,
"rF"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"readwrite"
,
readwriteCommand
,
1
,
"rF"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
...
...
src/server.h
View file @
00353f99
...
@@ -1421,6 +1421,7 @@ void getKeysFreeResult(int *result);
...
@@ -1421,6 +1421,7 @@ void getKeysFreeResult(int *result);
int
*
zunionInterGetKeys
(
struct
redisCommand
*
cmd
,
robj
**
argv
,
int
argc
,
int
*
numkeys
);
int
*
zunionInterGetKeys
(
struct
redisCommand
*
cmd
,
robj
**
argv
,
int
argc
,
int
*
numkeys
);
int
*
evalGetKeys
(
struct
redisCommand
*
cmd
,
robj
**
argv
,
int
argc
,
int
*
numkeys
);
int
*
evalGetKeys
(
struct
redisCommand
*
cmd
,
robj
**
argv
,
int
argc
,
int
*
numkeys
);
int
*
sortGetKeys
(
struct
redisCommand
*
cmd
,
robj
**
argv
,
int
argc
,
int
*
numkeys
);
int
*
sortGetKeys
(
struct
redisCommand
*
cmd
,
robj
**
argv
,
int
argc
,
int
*
numkeys
);
int
*
migrateGetKeys
(
struct
redisCommand
*
cmd
,
robj
**
argv
,
int
argc
,
int
*
numkeys
);
/* Cluster */
/* Cluster */
void
clusterInit
(
void
);
void
clusterInit
(
void
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment