提交 ca37e9cd 编写于 作者: A antirez

FLUSHALL/FLUSHDB no longer sync on disk. Just increment the dirty counter by...

FLUSHALL/FLUSHDB no longer sync on disk. Just increment the dirty counter by the number of elements removed, that will probably trigger a background saving operation
上级 975a5b6f
......@@ -875,13 +875,16 @@ static void initServer() {
}
/* Empty the whole database */
static void emptyDb() {
static long long emptyDb() {
int j;
long long removed = 0;
for (j = 0; j < server.dbnum; j++) {
removed += dictSize(server.db[j].dict);
dictEmpty(server.db[j].dict);
dictEmpty(server.db[j].expires);
}
return removed;
}
/* I agree, this is a very rudimental way to load a configuration...
......@@ -3038,18 +3041,17 @@ static void sunionstoreCommand(redisClient *c) {
}
static void flushdbCommand(redisClient *c) {
server.dirty += dictSize(c->db->dict);
dictEmpty(c->db->dict);
dictEmpty(c->db->expires);
server.dirty++;
addReply(c,shared.ok);
rdbSave(server.dbfilename);
}
static void flushallCommand(redisClient *c) {
emptyDb();
server.dirty++;
server.dirty += emptyDb();
addReply(c,shared.ok);
rdbSave(server.dbfilename);
server.dirty++;
}
redisSortOperation *createSortOperation(int type, robj *pattern) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册