Avoid unnecessary dict shrink in zremrangeGenericCommand (#13143)

If the skiplist is emptied, there is no need to shrink the dict in
skiplist, it can be deleted directly.
This commit is contained in:
Chen Tianjie 2024-03-19 10:14:19 +08:00 committed by GitHub
parent 7b070423b8
commit aeada20140
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2024,10 +2024,11 @@ void zremrangeGenericCommand(client *c, zrange_type rangetype) {
break;
}
dictResumeAutoResize(zs->dict);
dictShrinkIfNeeded(zs->dict);
if (dictSize(zs->dict) == 0) {
dbDelete(c->db,key);
keyremoved = 1;
} else {
dictShrinkIfNeeded(zs->dict);
}
} else {
serverPanic("Unknown sorted set encoding");