summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-12-11 15:57:11 +0100
committerantirez <antirez@gmail.com>2014-12-11 16:01:21 +0100
commit7de1ef773ed9359db3b1bf8041e67c050ec8c564 (patch)
tree415b2d09feaff50d064e912a8b18e199b185d3fa
parente945a546afd3f97b4f8b5231d44d2c46597469ea (diff)
downloadredis-7de1ef773ed9359db3b1bf8041e67c050ec8c564.tar.gz
SORT: Don't sort Set elements if not needed.
Related to #2094.
-rw-r--r--src/sort.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/sort.c b/src/sort.c
index f813ff26b..372481969 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -270,7 +270,9 @@ void sortCommand(redisClient *c) {
* The other types (list, sorted set) will retain their native order
* even if no sort order is requested, so they remain stable across
* scripting and replication. */
- if ((dontsort && sortval->type == REDIS_SET))
+ if (dontsort &&
+ sortval->type == REDIS_SET &&
+ (storekey || c->flags & REDIS_LUA_CLIENT))
{
/* Force ALPHA sorting */
dontsort = 0;