Commit 5f185413 authored by antirez's avatar antirez
Browse files

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

parent 2a11e94f
...@@ -226,6 +226,8 @@ void loadServerConfigFromString(char *config) { ...@@ -226,6 +226,8 @@ void loadServerConfigFromString(char *config) {
} }
} else if (!strcasecmp(argv[0],"maxmemory") && argc == 2) { } else if (!strcasecmp(argv[0],"maxmemory") && argc == 2) {
server.maxmemory = memtoll(argv[1],NULL); 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) { } else if (!strcasecmp(argv[0],"rss-aware-maxmemory") && argc==2) {
if ((server.rss_aware_maxmemory = yesnotoi(argv[1])) == -1) { if ((server.rss_aware_maxmemory = yesnotoi(argv[1])) == -1) {
err = "argument must be 'yes' or 'no'"; goto loaderr; err = "argument must be 'yes' or 'no'"; goto loaderr;
...@@ -635,6 +637,8 @@ void configSetCommand(redisClient *c) { ...@@ -635,6 +637,8 @@ void configSetCommand(redisClient *c) {
if (getLongLongFromObject(o,&ll) == REDIS_ERR || if (getLongLongFromObject(o,&ll) == REDIS_ERR ||
ll < 0) goto badfmt; ll < 0) goto badfmt;
server.maxmemory = ll; server.maxmemory = ll;
server.maxmemory_adjusted = ll;
server.maxmemory_enforced = ll;
if (server.maxmemory) { if (server.maxmemory) {
if (server.maxmemory < zmalloc_used_memory()) { 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."); 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.");
......
...@@ -1433,11 +1433,11 @@ void initServerConfig(void) { ...@@ -1433,11 +1433,11 @@ void initServerConfig(void) {
server.maxclients = REDIS_MAX_CLIENTS; server.maxclients = REDIS_MAX_CLIENTS;
server.bpop_blocked_clients = 0; server.bpop_blocked_clients = 0;
server.maxmemory = REDIS_DEFAULT_MAXMEMORY; 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_policy = REDIS_DEFAULT_MAXMEMORY_POLICY;
server.maxmemory_samples = REDIS_DEFAULT_MAXMEMORY_SAMPLES; server.maxmemory_samples = REDIS_DEFAULT_MAXMEMORY_SAMPLES;
server.rss_aware_maxmemory = REDIS_DEFAULT_RSS_AWARE_MAXMEMORY; 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_entries = REDIS_HASH_MAX_ZIPLIST_ENTRIES;
server.hash_max_ziplist_value = REDIS_HASH_MAX_ZIPLIST_VALUE; server.hash_max_ziplist_value = REDIS_HASH_MAX_ZIPLIST_VALUE;
server.list_max_ziplist_entries = REDIS_LIST_MAX_ZIPLIST_ENTRIES; server.list_max_ziplist_entries = REDIS_LIST_MAX_ZIPLIST_ENTRIES;
......
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