Avoid taking locks when we don't need to
Former-commit-id: 0d8d3ee9e217cd1f1366a117e6e212f610a028e1
This commit is contained in:
parent
165e73353a
commit
0d8da2c350
@ -2726,6 +2726,8 @@ void redisDbPersistentData::ensure(const char *sdsKey, dictEntry **pde)
|
|||||||
serverAssert(sdsKey != nullptr);
|
serverAssert(sdsKey != nullptr);
|
||||||
serverAssert(FImplies(*pde != nullptr, dictGetVal(*pde) != nullptr)); // early versions set a NULL object, this is no longer valid
|
serverAssert(FImplies(*pde != nullptr, dictGetVal(*pde) != nullptr)); // early versions set a NULL object, this is no longer valid
|
||||||
serverAssert(m_refCount == 0);
|
serverAssert(m_refCount == 0);
|
||||||
|
if (m_pdbSnapshot == nullptr && g_pserver->m_pstorageFactory == nullptr)
|
||||||
|
return;
|
||||||
std::unique_lock<fastlock> ul(g_expireLock);
|
std::unique_lock<fastlock> ul(g_expireLock);
|
||||||
|
|
||||||
// First see if the key can be obtained from a snapshot
|
// First see if the key can be obtained from a snapshot
|
||||||
|
Loading…
x
Reference in New Issue
Block a user