dict.c: added optional callback to dictEmpty().

Redis hash table implementation has many non-blocking features like
incremental rehashing, however while deleting a large hash table there
was no way to have a callback called to do some incremental work.

This commit adds this support, as an optiona callback argument to
dictEmpty() that is currently called at a fixed interval (one time every
65k deletions).
This commit is contained in:
antirez
2013-12-10 18:18:24 +01:00
parent 2c4ab8a534
commit 2eb781b35b
8 changed files with 22 additions and 21 deletions

View File

@ -261,7 +261,7 @@ void debugCommand(redisClient *c) {
addReply(c,shared.err);
return;
}
emptyDb();
emptyDb(NULL);
if (rdbLoad(server.rdb_filename) != REDIS_OK) {
addReplyError(c,"Error trying to load the RDB dump");
return;
@ -269,7 +269,7 @@ void debugCommand(redisClient *c) {
redisLog(REDIS_WARNING,"DB reloaded by DEBUG RELOAD");
addReply(c,shared.ok);
} else if (!strcasecmp(c->argv[1]->ptr,"loadaof")) {
emptyDb();
emptyDb(NULL);
if (loadAppendOnlyFile(server.aof_filename) != REDIS_OK) {
addReply(c,shared.err);
return;