Fix deadlock in storage prefetch
Former-commit-id: 9e6162de08248f7726b97b73aee2f23808ff4e7b
This commit is contained in:
parent
ef471e6e53
commit
c43bb8e8b5
@ -2959,7 +2959,7 @@ int dbnumFromDb(redisDb *db)
|
||||
serverPanic("invalid database pointer");
|
||||
}
|
||||
|
||||
void redisDbPersistentData::prefetchKeysAsync(parsed_command &command)
|
||||
void redisDbPersistentData::prefetchKeysAsync(client *c, parsed_command &command)
|
||||
{
|
||||
if (m_spstorage == nullptr)
|
||||
return;
|
||||
@ -2967,7 +2967,7 @@ void redisDbPersistentData::prefetchKeysAsync(parsed_command &command)
|
||||
AeLocker lock;
|
||||
|
||||
std::vector<robj*> veckeys;
|
||||
lock.arm(nullptr);
|
||||
lock.arm(c);
|
||||
getKeysResult result = GETKEYS_RESULT_INIT;
|
||||
auto cmd = lookupCommand(szFromObj(command.argv[0]));
|
||||
int numkeys = getKeysFromCommand(cmd, command.argv, command.argc, &result);
|
||||
@ -3000,7 +3000,7 @@ void redisDbPersistentData::prefetchKeysAsync(parsed_command &command)
|
||||
vecInserts.emplace_back(sharedKey, o, std::move(spexpire));
|
||||
}
|
||||
|
||||
lock.arm(nullptr);
|
||||
lock.arm(c);
|
||||
for (auto &tuple : vecInserts)
|
||||
{
|
||||
sds sharedKey = std::get<0>(tuple);
|
||||
|
@ -2362,7 +2362,7 @@ void parseClientCommandBuffer(client *c) {
|
||||
if (cqueries < c->vecqueuedcmd.size() && g_pserver->m_pstorageFactory != nullptr && !GlobalLocksAcquired()) {
|
||||
auto &query = c->vecqueuedcmd.back();
|
||||
if (query.argc > 0 && query.argc == query.argcMax) {
|
||||
c->db->prefetchKeysAsync(query);
|
||||
c->db->prefetchKeysAsync(c, query);
|
||||
}
|
||||
}
|
||||
c->reqtype = 0;
|
||||
|
@ -1136,7 +1136,7 @@ public:
|
||||
bool removeCachedValue(const char *key);
|
||||
void removeAllCachedValues();
|
||||
|
||||
void prefetchKeysAsync(struct parsed_command &command);
|
||||
void prefetchKeysAsync(client *c, struct parsed_command &command);
|
||||
|
||||
bool FSnapshot() const { return m_spdbSnapshotHOLDER != nullptr; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user