RSS aware maxmemory: enforced/adjusted == maxmemory on config changes.

This commit is contained in:
antirez 2014-11-17 10:46:42 +01:00
parent 2a11e94fdd
commit 5f185413df
2 changed files with 6 additions and 2 deletions

View File

@ -226,6 +226,8 @@ void loadServerConfigFromString(char *config) {
}
} else if (!strcasecmp(argv[0],"maxmemory") && argc == 2) {
server.maxmemory = memtoll(argv[1],NULL);
server.maxmemory_adjusted = server.maxmemory;
server.maxmemory_enforced = server.maxmemory;
} else if (!strcasecmp(argv[0],"rss-aware-maxmemory") && argc==2) {
if ((server.rss_aware_maxmemory = yesnotoi(argv[1])) == -1) {
err = "argument must be 'yes' or 'no'"; goto loaderr;
@ -635,6 +637,8 @@ void configSetCommand(redisClient *c) {
if (getLongLongFromObject(o,&ll) == REDIS_ERR ||
ll < 0) goto badfmt;
server.maxmemory = ll;
server.maxmemory_adjusted = ll;
server.maxmemory_enforced = ll;
if (server.maxmemory) {
if (server.maxmemory < zmalloc_used_memory()) {
redisLog(REDIS_WARNING,"WARNING: the new maxmemory value set via CONFIG SET is smaller than the current memory usage. This will result in keys eviction and/or inability to accept new write commands depending on the maxmemory-policy.");

View File

@ -1433,11 +1433,11 @@ void initServerConfig(void) {
server.maxclients = REDIS_MAX_CLIENTS;
server.bpop_blocked_clients = 0;
server.maxmemory = REDIS_DEFAULT_MAXMEMORY;
server.maxmemory_enforced = REDIS_DEFAULT_MAXMEMORY;
server.maxmemory_adjusted = REDIS_DEFAULT_MAXMEMORY;
server.maxmemory_policy = REDIS_DEFAULT_MAXMEMORY_POLICY;
server.maxmemory_samples = REDIS_DEFAULT_MAXMEMORY_SAMPLES;
server.rss_aware_maxmemory = REDIS_DEFAULT_RSS_AWARE_MAXMEMORY;
server.maxmemory_enforced = 0;
server.maxmemory_adjusted = 0;
server.hash_max_ziplist_entries = REDIS_HASH_MAX_ZIPLIST_ENTRIES;
server.hash_max_ziplist_value = REDIS_HASH_MAX_ZIPLIST_VALUE;
server.list_max_ziplist_entries = REDIS_LIST_MAX_ZIPLIST_ENTRIES;