Avoid unnecessary slot computing in KEYS command. (#12843)
If not in cluster mode, there is no need to compute slot. A bit optimization for #12754
This commit is contained in:
parent
8e11f84ded
commit
f2d59c4f91
4
src/db.c
4
src/db.c
@ -1003,12 +1003,12 @@ void keysCommand(client *c) {
|
||||
long numkeys = 0;
|
||||
void *replylen = addReplyDeferredLen(c);
|
||||
allkeys = (pattern[0] == '*' && plen == 1);
|
||||
if (!allkeys) {
|
||||
if (server.cluster_enabled && !allkeys) {
|
||||
pslot = patternHashSlot(pattern, plen);
|
||||
}
|
||||
dictIterator *di = NULL;
|
||||
dbIterator *dbit = NULL;
|
||||
if (server.cluster_enabled && !allkeys && pslot != -1) {
|
||||
if (pslot != -1) {
|
||||
di = dictGetSafeIterator(c->db->dict[pslot]);
|
||||
} else {
|
||||
dbit = dbIteratorInit(c->db, DB_MAIN);
|
||||
|
Loading…
x
Reference in New Issue
Block a user