summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2013-03-27 17:55:02 +0100
committerantirez <antirez@gmail.com>2013-03-27 17:55:02 +0100
commit32a83c8206a501f300e971f46cb6cd469731e74f (patch)
tree65810d63098fd34898dff5108f9ad27b559e8131
parent252cf3052dedbfd7a74d076898762e8ad0f265a0 (diff)
downloadredis-32a83c8206a501f300e971f46cb6cd469731e74f.tar.gz
DEBUG set-active-expire added.
We need the ability to disable the activeExpireCycle() (active expired key collection) call for testing purposes.
-rw-r--r--src/debug.c9
-rw-r--r--src/redis.c4
-rw-r--r--src/redis.h1
3 files changed, 11 insertions, 3 deletions
diff --git a/src/debug.c b/src/debug.c
index b71279795..cd3a22a92 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -332,9 +332,14 @@ void debugCommand(redisClient *c) {
usleep(utime);
addReply(c,shared.ok);
+ } else if (!strcasecmp(c->argv[1]->ptr,"set-active-expire") &&
+ c->argc == 3)
+ {
+ server.active_expire_enabled = atoi(c->argv[2]->ptr);
+ addReply(c,shared.ok);
} else {
- addReplyError(c,
- "Syntax error, try DEBUG [SEGFAULT|OBJECT <key>|SWAPIN <key>|SWAPOUT <key>|RELOAD]");
+ addReplyErrorFormat(c, "Unknown DEBUG subcommand '%s'",
+ (char*)c->argv[1]->ptr);
}
}
diff --git a/src/redis.c b/src/redis.c
index 079400114..dcb2499d8 100644
--- a/src/redis.c
+++ b/src/redis.c
@@ -854,7 +854,8 @@ void clientsCron(void) {
void databasesCron(void) {
/* Expire keys by random sampling. Not required for slaves
* as master will synthesize DELs for us. */
- if (server.masterhost == NULL) activeExpireCycle();
+ if (server.active_expire_enabled && server.masterhost == NULL)
+ activeExpireCycle();
/* Perform hash tables rehashing if needed, but only if there are no
* other processes saving the DB on disk. Otherwise rehashing is bad
@@ -1203,6 +1204,7 @@ void initServerConfig() {
server.verbosity = REDIS_NOTICE;
server.maxidletime = REDIS_MAXIDLETIME;
server.tcpkeepalive = 0;
+ server.active_expire_enabled = 1;
server.client_max_querybuf_len = REDIS_MAX_QUERYBUF_LEN;
server.saveparams = NULL;
server.loading = 0;
diff --git a/src/redis.h b/src/redis.h
index fc6eb95c9..a5ffa9304 100644
--- a/src/redis.h
+++ b/src/redis.h
@@ -728,6 +728,7 @@ struct redisServer {
int verbosity; /* Loglevel in redis.conf */
int maxidletime; /* Client timeout in seconds */
int tcpkeepalive; /* Set SO_KEEPALIVE if non-zero. */
+ int active_expire_enabled; /* Can be disabled for testing purposes. */
size_t client_max_querybuf_len; /* Limit for client query buffer length */
int dbnum; /* Total number of configured DBs */
int daemonize; /* True if running as a daemon */