Disable multithreaded rehash when active defrag is enabled. The two are not compatible

Former-commit-id: 56addcd17262ffbaefea26c0097cde53c616ece2
This commit is contained in:
John Sully 2021-01-27 06:50:01 +00:00
parent 1b3dc3d422
commit 662fc28fdc

View File

@ -1836,7 +1836,7 @@ void databasesCron(bool fMainThread) {
serverAssert(serverTL->rehashCtl == nullptr);
/* 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) {
if (rehashes_per_ms > 0 && async_rehashes < 131 && cserver.active_defrag_enabled) {
serverTL->rehashCtl = dictRehashAsyncStart(g_pserver->db[rehash_db].dict, rehashes_per_ms);
++async_rehashes;
}
@ -1858,7 +1858,9 @@ void databasesCron(bool fMainThread) {
if (rehashes_per_ms > 0) {
/* If the function did some work, stop here, we'll do
* more at the next cron loop. */
serverLog(LL_VERBOSE, "Calibrated rehashes per ms: %d", rehashes_per_ms);
if (!cserver.active_defrag_enabled) {
serverLog(LL_VERBOSE, "Calibrated rehashes per ms: %d", rehashes_per_ms);
}
break;
} else if (g_pserver->db[rehash_db].dict->asyncdata == nullptr) {
/* If this db didn't need rehash and we have none in flight, we'll try the next one. */