Only override maxmemory settings if everything is default
Former-commit-id: 9fb240d49c61f5a69124a17cfc769095cadd3d98
This commit is contained in:
parent
448b1093cd
commit
afce86838e
@ -229,15 +229,14 @@ static bool initializeStorageProvider(sds *argv, int argc, const char **err)
|
||||
if (fResult)
|
||||
{
|
||||
// We need to set max memory to a sane default so keys are actually evicted properly
|
||||
if (g_pserver->maxmemory == 0)
|
||||
if (g_pserver->maxmemory == 0 && g_pserver->maxmemory_policy == MAXMEMORY_NO_EVICTION)
|
||||
{
|
||||
struct sysinfo sys;
|
||||
if (sysinfo(&sys) == 0)
|
||||
{
|
||||
// By default it's half the memory. This gives sufficient room for background saving
|
||||
g_pserver->maxmemory = sys.totalram / 2;
|
||||
if (g_pserver->maxmemory_policy == MAXMEMORY_NO_EVICTION)
|
||||
g_pserver->maxmemory_policy = MAXMEMORY_ALLKEYS_LRU;
|
||||
g_pserver->maxmemory_policy = MAXMEMORY_ALLKEYS_LRU;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user