X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/d6107fd6f194f568bd0fec3230cae83973de929d..ef67a2fc3c24d346efb1fa73b822e6a160229166:/src/sort.c diff --git a/src/sort.c b/src/sort.c index a44a6d63..e4fe130c 100644 --- a/src/sort.c +++ b/src/sort.c @@ -199,6 +199,9 @@ void sortCommand(redisClient *c) { j++; } + /* Destructively convert encoded sorted sets for SORT. */ + if (sortval->type == REDIS_ZSET) zsetConvert(sortval, REDIS_ENCODING_SKIPLIST); + /* Load the sorting vector with all the objects to sort */ switch(sortval->type) { case REDIS_LIST: vectorlen = listTypeLength(sortval); break; @@ -363,12 +366,12 @@ void sortCommand(redisClient *c) { } } } - dbReplace(c->db,storekey,sobj); + setKey(c->db,storekey,sobj); + decrRefCount(sobj); /* Note: we add 1 because the DB is dirty anyway since even if the * SORT result is empty a new key is set and maybe the old content * replaced. */ server.dirty += 1+outputlen; - touchWatchedKey(c->db,storekey); addReplyLongLong(c,outputlen); }