summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-03-10 16:28:18 +0100
committerantirez <antirez@gmail.com>2014-03-11 11:10:33 +0100
commit3b80e0a41d3dcaa492da559f0669def34b5469ab (patch)
tree45d06c7b4d86abdecf0b38556b81aa30ca29d1e6
parent399fca8f45eb0c6482c421ee99b2f7389b4fd526 (diff)
downloadredis-3b80e0a41d3dcaa492da559f0669def34b5469ab.tar.gz
Cluster: don't allow BY option of SORT as well.
There is the exception of a "constant" BY pattern that is used in order to signal to don't sort at all. In this case no lookup is needed so it is possible to support this case in Cluster mode.
-rw-r--r--src/sort.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/sort.c b/src/sort.c
index 95c87cc04..fedf0cf3a 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -248,7 +248,17 @@ void sortCommand(redisClient *c) {
sortby = c->argv[j+1];
/* If the BY pattern does not contain '*', i.e. it is constant,
* we don't need to sort nor to lookup the weight keys. */
- if (strchr(c->argv[j+1]->ptr,'*') == NULL) dontsort = 1;
+ if (strchr(c->argv[j+1]->ptr,'*') == NULL) {
+ dontsort = 1;
+ } else {
+ /* If BY is specified with a real patter, we can't accept
+ * it in cluster mode. */
+ if (server.cluster_enabled) {
+ addReplyError(c,"BY option of SORT denied in Cluster mode.");
+ syntax_error++;
+ break;
+ }
+ }
j++;
} else if (!strcasecmp(c->argv[j]->ptr,"get") && leftargs >= 1) {
if (server.cluster_enabled) {