Disable async rehash during load as it interferes with eviction

Former-commit-id: 54b4f39e9d634bf53b04cd94433b051b14323bc6
This commit is contained in:
John Sully 2021-07-19 18:17:54 +00:00
parent 2609b87a95
commit 795da380a2
2 changed files with 2 additions and 2 deletions

View File

@ -3020,7 +3020,7 @@ void redisDbPersistentData::removeAllCachedValues()
trackChanges(false);
}
if (m_pdict->pauserehash == 0) {
if (m_pdict->pauserehash == 0 && m_pdict->refcount == 1) {
dict *dT = m_pdict;
m_pdict = dictCreate(&dbDictType, this);
dictExpand(m_pdict, dictSize(dT)/2, false); // Make room for about half so we don't excessively rehash

View File

@ -2124,7 +2124,7 @@ void databasesCron(bool fMainThread) {
::dict *dict = g_pserver->db[rehash_db]->dictUnsafeKeyOnly();
/* Are we async rehashing? And if so is it time to re-calibrate? */
/* The recalibration limit is a prime number to ensure balancing across threads */
if (rehashes_per_ms > 0 && async_rehashes < 131 && !cserver.active_defrag_enabled && cserver.cthreads > 1) {
if (rehashes_per_ms > 0 && async_rehashes < 131 && !cserver.active_defrag_enabled && cserver.cthreads > 1 && dictSize(dict) > 2048 && dictIsRehashing(dict) && !g_pserver->loading) {
serverTL->rehashCtl = dictRehashAsyncStart(dict, rehashes_per_ms);
++async_rehashes;
}