From 0d8da2c35002905751d07ac7705a5605ee7c5291 Mon Sep 17 00:00:00 2001 From: John Sully Date: Fri, 25 Jun 2021 06:11:14 +0000 Subject: [PATCH] Avoid taking locks when we don't need to Former-commit-id: 0d8d3ee9e217cd1f1366a117e6e212f610a028e1 --- src/db.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/db.cpp b/src/db.cpp index 71cb27a03..ecda7e55b 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -2726,6 +2726,8 @@ void redisDbPersistentData::ensure(const char *sdsKey, dictEntry **pde) serverAssert(sdsKey != nullptr); serverAssert(FImplies(*pde != nullptr, dictGetVal(*pde) != nullptr)); // early versions set a NULL object, this is no longer valid serverAssert(m_refCount == 0); + if (m_pdbSnapshot == nullptr && g_pserver->m_pstorageFactory == nullptr) + return; std::unique_lock ul(g_expireLock); // First see if the key can be obtained from a snapshot