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
c2eb4a60
Commit
c2eb4a60
authored
Feb 25, 2013
by
antirez
Browse files
Cluster: use CountKeysInSlot() when we just need the count.
parent
ad3bca1f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
c2eb4a60
...
@@ -1534,13 +1534,7 @@ void clusterCommand(redisClient *c) {
...
@@ -1534,13 +1534,7 @@ void clusterCommand(redisClient *c) {
if
(
server
.
cluster
->
slots
[
slot
]
==
server
.
cluster
->
myself
&&
if
(
server
.
cluster
->
slots
[
slot
]
==
server
.
cluster
->
myself
&&
n
!=
server
.
cluster
->
myself
)
n
!=
server
.
cluster
->
myself
)
{
{
int
numkeys
;
if
(
CountKeysInSlot
(
slot
)
!=
0
)
{
robj
**
keys
;
keys
=
zmalloc
(
sizeof
(
robj
*
)
*
1
);
numkeys
=
GetKeysInSlot
(
slot
,
keys
,
1
);
zfree
(
keys
);
if
(
numkeys
!=
0
)
{
addReplyErrorFormat
(
c
,
"Can't assign hashslot %d to a different node while I still hold keys for this hash slot."
,
slot
);
addReplyErrorFormat
(
c
,
"Can't assign hashslot %d to a different node while I still hold keys for this hash slot."
,
slot
);
return
;
return
;
}
}
...
...
src/redis.h
View file @
c2eb4a60
...
@@ -1227,6 +1227,7 @@ int selectDb(redisClient *c, int id);
...
@@ -1227,6 +1227,7 @@ int selectDb(redisClient *c, int id);
void
signalModifiedKey
(
redisDb
*
db
,
robj
*
key
);
void
signalModifiedKey
(
redisDb
*
db
,
robj
*
key
);
void
signalFlushedDb
(
int
dbid
);
void
signalFlushedDb
(
int
dbid
);
unsigned
int
GetKeysInSlot
(
unsigned
int
hashslot
,
robj
**
keys
,
unsigned
int
count
);
unsigned
int
GetKeysInSlot
(
unsigned
int
hashslot
,
robj
**
keys
,
unsigned
int
count
);
unsigned
int
CountKeysInSlot
(
unsigned
int
hashslot
);
int
verifyClusterConfigWithData
(
void
);
int
verifyClusterConfigWithData
(
void
);
/* API to get key arguments from commands */
/* API to get key arguments from commands */
...
...
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