Limit max overage to 20% during RDB save

This commit is contained in:
John Sully 2022-05-10 18:30:12 +00:00
parent f747044034
commit 442c3de350

View File

@ -423,7 +423,7 @@ int getMaxmemoryState(size_t *total, size_t *logical, size_t *tofree, float *lev
if (fPreSnapshot) if (fPreSnapshot)
maxmemory = static_cast<size_t>(maxmemory * 0.9); // derate memory by 10% since we won't be able to free during snapshot maxmemory = static_cast<size_t>(maxmemory * 0.9); // derate memory by 10% since we won't be able to free during snapshot
if (g_pserver->FRdbSaveInProgress()) if (g_pserver->FRdbSaveInProgress())
maxmemory = static_cast<size_t>(maxmemory*1.5); maxmemory = static_cast<size_t>(maxmemory*1.2);
/* We may return ASAP if there is no need to compute the level. */ /* We may return ASAP if there is no need to compute the level. */
int return_ok_asap = !maxmemory || mem_reported <= maxmemory; int return_ok_asap = !maxmemory || mem_reported <= maxmemory;