Key prefetch error handling instead of crashign
Former-commit-id: b322a14efb1b897134b229c1726b45264b57783f
This commit is contained in:
parent
877ad1e4b2
commit
6065f276c4
12
src/db.cpp
12
src/db.cpp
@ -2970,6 +2970,8 @@ void redisDbPersistentData::prefetchKeysAsync(client *c, parsed_command &command
|
|||||||
lock.arm(c);
|
lock.arm(c);
|
||||||
getKeysResult result = GETKEYS_RESULT_INIT;
|
getKeysResult result = GETKEYS_RESULT_INIT;
|
||||||
auto cmd = lookupCommand(szFromObj(command.argv[0]));
|
auto cmd = lookupCommand(szFromObj(command.argv[0]));
|
||||||
|
if (cmd == nullptr)
|
||||||
|
return; // Bad command? It's not for us to judge, just bail
|
||||||
int numkeys = getKeysFromCommand(cmd, command.argv, command.argc, &result);
|
int numkeys = getKeysFromCommand(cmd, command.argv, command.argc, &result);
|
||||||
for (int ikey = 0; ikey < numkeys; ++ikey)
|
for (int ikey = 0; ikey < numkeys; ++ikey)
|
||||||
{
|
{
|
||||||
@ -2994,10 +2996,14 @@ void redisDbPersistentData::prefetchKeysAsync(client *c, parsed_command &command
|
|||||||
serverAssert(o != nullptr);
|
serverAssert(o != nullptr);
|
||||||
}, &sharedKey);
|
}, &sharedKey);
|
||||||
|
|
||||||
if (sharedKey == nullptr)
|
if (o != nullptr) {
|
||||||
sharedKey = sdsdupshared(szFromObj(objKey));
|
if (sharedKey == nullptr)
|
||||||
|
sharedKey = sdsdupshared(szFromObj(objKey));
|
||||||
|
|
||||||
vecInserts.emplace_back(sharedKey, o, std::move(spexpire));
|
vecInserts.emplace_back(sharedKey, o, std::move(spexpire));
|
||||||
|
} else if (sharedKey != nullptr) {
|
||||||
|
sdsfree(sharedKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lock.arm(c);
|
lock.arm(c);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user