summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhaozhao.zz <zhaozhao.zz@alibaba-inc.com>2019-07-17 11:00:51 +0800
committerzhaozhao.zz <zhaozhao.zz@alibaba-inc.com>2019-12-18 16:54:49 +0800
commit3c0ed0309ac5bae52464ecb45e92056e212f2b7f (patch)
tree5e5259a837a69918ff6d01e6be25a60fd5af19de
parentb7c78b7651c5458ccf5d95ef5857ec427b927a27 (diff)
downloadredis-3c0ed0309ac5bae52464ecb45e92056e212f2b7f.tar.gz
lazyfree: add a new configuration lazyfree-lazy-user-del
Delete keys in async way when executing DEL command, if lazyfree-lazy-user-del is yes.
-rw-r--r--redis.conf5
-rw-r--r--src/config.c1
-rw-r--r--src/db.c2
-rw-r--r--src/server.h1
4 files changed, 7 insertions, 2 deletions
diff --git a/redis.conf b/redis.conf
index 870849a79..a0e1b5aa9 100644
--- a/redis.conf
+++ b/redis.conf
@@ -924,7 +924,9 @@ replica-priority 100
# or SORT with STORE option may delete existing keys. The SET command
# itself removes any old content of the specified key in order to replace
# it with the specified string.
-# 4) During replication, when a replica performs a full resynchronization with
+# 4) The DEL command itself, and normally it's not easy to replace DEL with
+# UNLINK in user's codes.
+# 5) During replication, when a replica performs a full resynchronization with
# its master, the content of the whole database is removed in order to
# load the RDB file just transferred.
#
@@ -936,6 +938,7 @@ replica-priority 100
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
+lazyfree-lazy-user-del no
replica-lazy-flush no
############################## APPEND ONLY MODE ###############################
diff --git a/src/config.c b/src/config.c
index 3d53e656b..0bb2fc237 100644
--- a/src/config.c
+++ b/src/config.c
@@ -2147,6 +2147,7 @@ standardConfig configs[] = {
createBoolConfig("lazyfree-lazy-eviction", NULL, MODIFIABLE_CONFIG, server.lazyfree_lazy_eviction, 0, NULL, NULL),
createBoolConfig("lazyfree-lazy-expire", NULL, MODIFIABLE_CONFIG, server.lazyfree_lazy_expire, 0, NULL, NULL),
createBoolConfig("lazyfree-lazy-server-del", NULL, MODIFIABLE_CONFIG, server.lazyfree_lazy_server_del, 0, NULL, NULL),
+ createBoolConfig("lazyfree-lazy-user-del", NULL, MODIFIABLE_CONFIG, server.lazyfree_lazy_user_del , 0, NULL, NULL),
createBoolConfig("repl-disable-tcp-nodelay", NULL, MODIFIABLE_CONFIG, server.repl_disable_tcp_nodelay, 0, NULL, NULL),
createBoolConfig("repl-diskless-sync", NULL, MODIFIABLE_CONFIG, server.repl_diskless_sync, 0, NULL, NULL),
createBoolConfig("gopher-enabled", NULL, MODIFIABLE_CONFIG, server.gopher_enabled, 0, NULL, NULL),
diff --git a/src/db.c b/src/db.c
index 483095a7c..88102e557 100644
--- a/src/db.c
+++ b/src/db.c
@@ -536,7 +536,7 @@ void delGenericCommand(client *c, int lazy) {
}
void delCommand(client *c) {
- delGenericCommand(c,0);
+ delGenericCommand(c,server.lazyfree_lazy_user_del);
}
void unlinkCommand(client *c) {
diff --git a/src/server.h b/src/server.h
index 7a78c884f..8c25534fe 100644
--- a/src/server.h
+++ b/src/server.h
@@ -1375,6 +1375,7 @@ struct redisServer {
int lazyfree_lazy_eviction;
int lazyfree_lazy_expire;
int lazyfree_lazy_server_del;
+ int lazyfree_lazy_user_del;
/* Latency monitor */
long long latency_monitor_threshold;
dict *latency_events;