Disable async rehash during load as it interferes with eviction
Former-commit-id: 54b4f39e9d634bf53b04cd94433b051b14323bc6
This commit is contained in:
parent
2609b87a95
commit
795da380a2
@ -3020,7 +3020,7 @@ void redisDbPersistentData::removeAllCachedValues()
|
|||||||
trackChanges(false);
|
trackChanges(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pdict->pauserehash == 0) {
|
if (m_pdict->pauserehash == 0 && m_pdict->refcount == 1) {
|
||||||
dict *dT = m_pdict;
|
dict *dT = m_pdict;
|
||||||
m_pdict = dictCreate(&dbDictType, this);
|
m_pdict = dictCreate(&dbDictType, this);
|
||||||
dictExpand(m_pdict, dictSize(dT)/2, false); // Make room for about half so we don't excessively rehash
|
dictExpand(m_pdict, dictSize(dT)/2, false); // Make room for about half so we don't excessively rehash
|
||||||
|
@ -2124,7 +2124,7 @@ void databasesCron(bool fMainThread) {
|
|||||||
::dict *dict = g_pserver->db[rehash_db]->dictUnsafeKeyOnly();
|
::dict *dict = g_pserver->db[rehash_db]->dictUnsafeKeyOnly();
|
||||||
/* Are we async rehashing? And if so is it time to re-calibrate? */
|
/* 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 */
|
/* 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);
|
serverTL->rehashCtl = dictRehashAsyncStart(dict, rehashes_per_ms);
|
||||||
++async_rehashes;
|
++async_rehashes;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user