File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2134,7 +2134,7 @@ void databasesCron(bool fMainThread) {
21342134 ::dict *dict = g_pserver->db [rehash_db]->dictUnsafeKeyOnly ();
21352135 /* Are we async rehashing? And if so is it time to re-calibrate? */
21362136 /* The recalibration limit is a prime number to ensure balancing across threads */
2137- if (rehashes_per_ms > 0 && async_rehashes < 131 && !cserver.active_defrag_enabled && cserver.cthreads > 1 && dictSize (dict) > 2048 && dictIsRehashing (dict) && !g_pserver->loading ) {
2137+ if (rehashes_per_ms > 0 && async_rehashes < 131 && !cserver.active_defrag_enabled && cserver.cthreads > 1 && dictSize (dict) > 2048 && dictIsRehashing (dict) && !g_pserver->loading && aeLockContention () > 1 ) {
21382138 serverTL->rehashCtl = dictRehashAsyncStart (dict, rehashes_per_ms * ((1000 / g_pserver->hz ) / 10 )); // Estimate 10% CPU time spent in lock contention
21392139 if (serverTL->rehashCtl )
21402140 ++async_rehashes;
You can’t perform that action at this time.
0 commit comments