Commit 32a83c82 authored by antirez's avatar antirez
Browse files

DEBUG set-active-expire added.

We need the ability to disable the activeExpireCycle() (active
expired key collection) call for testing purposes.
parent 252cf305
...@@ -332,9 +332,14 @@ void debugCommand(redisClient *c) { ...@@ -332,9 +332,14 @@ void debugCommand(redisClient *c) {
usleep(utime); usleep(utime);
addReply(c,shared.ok); 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 { } else {
addReplyError(c, addReplyErrorFormat(c, "Unknown DEBUG subcommand '%s'",
"Syntax error, try DEBUG [SEGFAULT|OBJECT <key>|SWAPIN <key>|SWAPOUT <key>|RELOAD]"); (char*)c->argv[1]->ptr);
} }
} }
......
...@@ -854,7 +854,8 @@ void clientsCron(void) { ...@@ -854,7 +854,8 @@ void clientsCron(void) {
void databasesCron(void) { void databasesCron(void) {
/* Expire keys by random sampling. Not required for slaves /* Expire keys by random sampling. Not required for slaves
* as master will synthesize DELs for us. */ * 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 /* Perform hash tables rehashing if needed, but only if there are no
* other processes saving the DB on disk. Otherwise rehashing is bad * other processes saving the DB on disk. Otherwise rehashing is bad
...@@ -1203,6 +1204,7 @@ void initServerConfig() { ...@@ -1203,6 +1204,7 @@ void initServerConfig() {
server.verbosity = REDIS_NOTICE; server.verbosity = REDIS_NOTICE;
server.maxidletime = REDIS_MAXIDLETIME; server.maxidletime = REDIS_MAXIDLETIME;
server.tcpkeepalive = 0; server.tcpkeepalive = 0;
server.active_expire_enabled = 1;
server.client_max_querybuf_len = REDIS_MAX_QUERYBUF_LEN; server.client_max_querybuf_len = REDIS_MAX_QUERYBUF_LEN;
server.saveparams = NULL; server.saveparams = NULL;
server.loading = 0; server.loading = 0;
......
...@@ -728,6 +728,7 @@ struct redisServer { ...@@ -728,6 +728,7 @@ struct redisServer {
int verbosity; /* Loglevel in redis.conf */ int verbosity; /* Loglevel in redis.conf */
int maxidletime; /* Client timeout in seconds */ int maxidletime; /* Client timeout in seconds */
int tcpkeepalive; /* Set SO_KEEPALIVE if non-zero. */ 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 */ size_t client_max_querybuf_len; /* Limit for client query buffer length */
int dbnum; /* Total number of configured DBs */ int dbnum; /* Total number of configured DBs */
int daemonize; /* True if running as a daemon */ int daemonize; /* True if running as a daemon */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment