mirror of
https://github.com/fluencelabs/redis
synced 2025-04-22 17:12:13 +00:00
Cluster: empty the internal sorted set mapping keys to slots on FLUSHDB/ALL.
This commit is contained in:
parent
efe51dfff5
commit
d04770988d
8
src/db.c
8
src/db.c
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
void SlotToKeyAdd(robj *key);
|
void SlotToKeyAdd(robj *key);
|
||||||
void SlotToKeyDel(robj *key);
|
void SlotToKeyDel(robj *key);
|
||||||
|
void SlotToKeyFlush(void);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
/*-----------------------------------------------------------------------------
|
||||||
* C-level DB API
|
* C-level DB API
|
||||||
@ -213,12 +214,14 @@ void flushdbCommand(redisClient *c) {
|
|||||||
signalFlushedDb(c->db->id);
|
signalFlushedDb(c->db->id);
|
||||||
dictEmpty(c->db->dict);
|
dictEmpty(c->db->dict);
|
||||||
dictEmpty(c->db->expires);
|
dictEmpty(c->db->expires);
|
||||||
|
if (server.cluster_enabled) SlotToKeyFlush();
|
||||||
addReply(c,shared.ok);
|
addReply(c,shared.ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
void flushallCommand(redisClient *c) {
|
void flushallCommand(redisClient *c) {
|
||||||
signalFlushedDb(-1);
|
signalFlushedDb(-1);
|
||||||
server.dirty += emptyDb();
|
server.dirty += emptyDb();
|
||||||
|
if (server.cluster_enabled) SlotToKeyFlush();
|
||||||
addReply(c,shared.ok);
|
addReply(c,shared.ok);
|
||||||
if (server.rdb_child_pid != -1) {
|
if (server.rdb_child_pid != -1) {
|
||||||
kill(server.rdb_child_pid,SIGUSR1);
|
kill(server.rdb_child_pid,SIGUSR1);
|
||||||
@ -755,6 +758,11 @@ void SlotToKeyDel(robj *key) {
|
|||||||
zslDelete(server.cluster->slots_to_keys,hashslot,key);
|
zslDelete(server.cluster->slots_to_keys,hashslot,key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SlotToKeyFlush(void) {
|
||||||
|
zslFree(server.cluster->slots_to_keys);
|
||||||
|
server.cluster->slots_to_keys = zslCreate();
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int GetKeysInSlot(unsigned int hashslot, robj **keys, unsigned int count) {
|
unsigned int GetKeysInSlot(unsigned int hashslot, robj **keys, unsigned int count) {
|
||||||
zskiplistNode *n;
|
zskiplistNode *n;
|
||||||
zrangespec range;
|
zrangespec range;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user