X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/8d3e063a0ac13ad10ad47df15cbb6bbc8116bf2f..5402c4262e6bd6d2e8082dd2a948f28ea453b060:/src/config.c diff --git a/src/config.c b/src/config.c index 2b5063c8..ad60cced 100644 --- a/src/config.c +++ b/src/config.c @@ -136,6 +136,8 @@ void loadServerConfig(char *filename) { server.maxmemory_policy = REDIS_MAXMEMORY_ALLKEYS_LRU; } else if (!strcasecmp(argv[1],"allkeys-random")) { server.maxmemory_policy = REDIS_MAXMEMORY_ALLKEYS_RANDOM; + } else if (!strcasecmp(argv[1],"noeviction")) { + server.maxmemory_policy = REDIS_MAXMEMORY_NO_EVICTION; } else { err = "Invalid maxmemory policy"; goto loaderr; @@ -152,6 +154,10 @@ void loadServerConfig(char *filename) { server.replstate = REDIS_REPL_CONNECT; } else if (!strcasecmp(argv[0],"masterauth") && argc == 2) { server.masterauth = zstrdup(argv[1]); + } else if (!strcasecmp(argv[0],"slave-serve-stale-data") && argc == 2) { + if ((server.repl_serve_stale_data = yesnotoi(argv[1])) == -1) { + err = "argument must be 'yes' or 'no'"; goto loaderr; + } } else if (!strcasecmp(argv[0],"glueoutputbuf") && argc == 2) { if ((server.glueoutputbuf = yesnotoi(argv[1])) == -1) { err = "argument must be 'yes' or 'no'"; goto loaderr; @@ -303,6 +309,8 @@ void configSetCommand(redisClient *c) { server.maxmemory_policy = REDIS_MAXMEMORY_ALLKEYS_LRU; } else if (!strcasecmp(o->ptr,"allkeys-random")) { server.maxmemory_policy = REDIS_MAXMEMORY_ALLKEYS_RANDOM; + } else if (!strcasecmp(o->ptr,"noeviction")) { + server.maxmemory_policy = REDIS_MAXMEMORY_NO_EVICTION; } else { goto badfmt; } @@ -379,6 +387,11 @@ void configSetCommand(redisClient *c) { appendServerSaveParams(seconds, changes); } sdsfreesplitres(v,vlen); + } else if (!strcasecmp(c->argv[2]->ptr,"slave-serve-stale-data")) { + int yn = yesnotoi(o->ptr); + + if (yn == -1) goto badfmt; + server.repl_serve_stale_data = yn; } else { addReplyErrorFormat(c,"Unsupported CONFIG parameter: %s", (char*)c->argv[2]->ptr); @@ -431,6 +444,7 @@ void configGetCommand(redisClient *c) { case REDIS_MAXMEMORY_VOLATILE_RANDOM: s = "volatile-random"; break; case REDIS_MAXMEMORY_ALLKEYS_LRU: s = "allkeys-lru"; break; case REDIS_MAXMEMORY_ALLKEYS_RANDOM: s = "allkeys-random"; break; + case REDIS_MAXMEMORY_NO_EVICTION: s = "noeviction"; break; default: s = "unknown"; break; /* too harmless to panic */ } addReplyBulkCString(c,"maxmemory-policy"); @@ -488,6 +502,11 @@ void configGetCommand(redisClient *c) { sdsfree(buf); matches++; } + if (stringmatch(pattern,"slave-serve-stale-data",0)) { + addReplyBulkCString(c,"slave-serve-stale-data"); + addReplyBulkCString(c,server.repl_serve_stale_data ? "yes" : "no"); + matches++; + } setDeferredMultiBulkLength(c,replylen,matches*2); }