Add fallback if we fail to evict normally with FLASH (flush everything)
Former-commit-id: 66ee85a8d5e24514083aa3478dcf0cf3da86520e
This commit is contained in:
parent
20c1b7eb63
commit
9a54e3f530
@ -666,6 +666,21 @@ int freeMemoryIfNeeded(void) {
|
||||
return C_OK;
|
||||
|
||||
cant_free:
|
||||
if (!cserver.delete_on_evict)
|
||||
{
|
||||
for (int idb = 0; idb < cserver.dbnum; ++idb)
|
||||
{
|
||||
redisDb *db = g_pserver->db[idb];
|
||||
if (db->FStorageProvider())
|
||||
{
|
||||
serverLog(LL_WARNING, "Failed to evict keys, falling back to flushing entire cache. Consider increasing maxmemory-samples.");
|
||||
db->removeAllCachedValues();
|
||||
if (((mem_reported - zmalloc_used_memory()) + mem_freed) >= mem_tofree)
|
||||
return C_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* We are here if we are not able to reclaim memory. There is only one
|
||||
* last thing we can try: check if the lazyfree thread has jobs in queue
|
||||
* and wait... */
|
||||
|
Loading…
x
Reference in New Issue
Block a user