From cdc5e8fa91c5e863115844f93b7f8f9751f29eb7 Mon Sep 17 00:00:00 2001 From: John Sully Date: Mon, 25 Sep 2023 06:03:47 +0000 Subject: [PATCH] Remove a global lock --- src/db.cpp | 2 +- src/server.cpp | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/db.cpp b/src/db.cpp index 6e0f127e8..c4bcb2870 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -3181,7 +3181,7 @@ void redisDbPersistentData::trackChanges(bool fBulk, size_t sizeHint) if (fBulk) m_fAllChanged.fetch_add(1, std::memory_order_acq_rel); - if (sizeHint > 0) + if (sizeHint > 0 && aeThreadOwnsLock()) dictExpand(m_dictChanged, sizeHint, false); } diff --git a/src/server.cpp b/src/server.cpp index 0bbf2dec4..4792d0fd9 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -3068,10 +3068,8 @@ void afterSleep(struct aeEventLoop *eventLoop) { serverAssert(serverTL->gcEpoch.isReset()); serverTL->gcEpoch = g_pserver->garbageCollector.startEpoch(); - aeAcquireLock(); for (int idb = 0; idb < cserver.dbnum; ++idb) g_pserver->db[idb]->trackChanges(false); - aeReleaseLock(); serverTL->disable_async_commands = false; }