X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/2c861050c17237a61fdaff4da2777c5d18ce979a..dfc25454701638d39bc75fbc3f9c55619b503bd0:/src/sort.c diff --git a/src/sort.c b/src/sort.c index 11b73ad3..3f02e49a 100644 --- a/src/sort.c +++ b/src/sort.c @@ -203,6 +203,15 @@ void sortCommand(redisClient *c) { j++; } + /* If we have STORE we need to force sorting for deterministic output + * and replication. We use alpha sorting since this is guaranteed to + * work with any input. */ + if (storekey && dontsort) { + dontsort = 0; + alpha = 1; + sortby = NULL; + } + /* Destructively convert encoded sorted sets for SORT. */ if (sortval->type == REDIS_ZSET) zsetConvert(sortval, REDIS_ENCODING_SKIPLIST);