From 662fc28fdc8e1617589ae529176cf2adcd28a3e6 Mon Sep 17 00:00:00 2001 From: John Sully Date: Wed, 27 Jan 2021 06:50:01 +0000 Subject: [PATCH] Disable multithreaded rehash when active defrag is enabled. The two are not compatible Former-commit-id: 56addcd17262ffbaefea26c0097cde53c616ece2 --- src/server.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/server.cpp b/src/server.cpp index d95e207dc..4e4418b02 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -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. */