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
392e0fa7
Commit
392e0fa7
authored
Feb 22, 2013
by
antirez
Browse files
Cluster: fix case of slotToKey...() functions.
parent
d0477098
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/db.c
View file @
392e0fa7
...
...
@@ -32,9 +32,9 @@
#include <signal.h>
#include <ctype.h>
void
S
lotToKeyAdd
(
robj
*
key
);
void
S
lotToKeyDel
(
robj
*
key
);
void
S
lotToKeyFlush
(
void
);
void
s
lotToKeyAdd
(
robj
*
key
);
void
s
lotToKeyDel
(
robj
*
key
);
void
s
lotToKeyFlush
(
void
);
/*-----------------------------------------------------------------------------
* C-level DB API
...
...
@@ -94,7 +94,7 @@ void dbAdd(redisDb *db, robj *key, robj *val) {
int
retval
=
dictAdd
(
db
->
dict
,
copy
,
val
);
redisAssertWithInfo
(
NULL
,
key
,
retval
==
REDIS_OK
);
if
(
server
.
cluster_enabled
)
S
lotToKeyAdd
(
key
);
if
(
server
.
cluster_enabled
)
s
lotToKeyAdd
(
key
);
}
/* Overwrite an existing key with a new value. Incrementing the reference
...
...
@@ -162,7 +162,7 @@ int dbDelete(redisDb *db, robj *key) {
* the key, because it is shared with the main dictionary. */
if
(
dictSize
(
db
->
expires
)
>
0
)
dictDelete
(
db
->
expires
,
key
->
ptr
);
if
(
dictDelete
(
db
->
dict
,
key
->
ptr
)
==
DICT_OK
)
{
if
(
server
.
cluster_enabled
)
S
lotToKeyDel
(
key
);
if
(
server
.
cluster_enabled
)
s
lotToKeyDel
(
key
);
return
1
;
}
else
{
return
0
;
...
...
@@ -214,14 +214,14 @@ void flushdbCommand(redisClient *c) {
signalFlushedDb
(
c
->
db
->
id
);
dictEmpty
(
c
->
db
->
dict
);
dictEmpty
(
c
->
db
->
expires
);
if
(
server
.
cluster_enabled
)
S
lotToKeyFlush
();
if
(
server
.
cluster_enabled
)
s
lotToKeyFlush
();
addReply
(
c
,
shared
.
ok
);
}
void
flushallCommand
(
redisClient
*
c
)
{
signalFlushedDb
(
-
1
);
server
.
dirty
+=
emptyDb
();
if
(
server
.
cluster_enabled
)
S
lotToKeyFlush
();
if
(
server
.
cluster_enabled
)
s
lotToKeyFlush
();
addReply
(
c
,
shared
.
ok
);
if
(
server
.
rdb_child_pid
!=
-
1
)
{
kill
(
server
.
rdb_child_pid
,
SIGUSR1
);
...
...
@@ -745,20 +745,20 @@ int *zunionInterGetKeys(struct redisCommand *cmd,robj **argv, int argc, int *num
/* 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
* while rehashing the cluster. */
void
S
lotToKeyAdd
(
robj
*
key
)
{
void
s
lotToKeyAdd
(
robj
*
key
)
{
unsigned
int
hashslot
=
keyHashSlot
(
key
->
ptr
,
sdslen
(
key
->
ptr
));
zslInsert
(
server
.
cluster
->
slots_to_keys
,
hashslot
,
key
);
incrRefCount
(
key
);
}
void
S
lotToKeyDel
(
robj
*
key
)
{
void
s
lotToKeyDel
(
robj
*
key
)
{
unsigned
int
hashslot
=
keyHashSlot
(
key
->
ptr
,
sdslen
(
key
->
ptr
));
zslDelete
(
server
.
cluster
->
slots_to_keys
,
hashslot
,
key
);
}
void
S
lotToKeyFlush
(
void
)
{
void
s
lotToKeyFlush
(
void
)
{
zslFree
(
server
.
cluster
->
slots_to_keys
);
server
.
cluster
->
slots_to_keys
=
zslCreate
();
}
...
...
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