[BUG] Incorrect error msg for XREAD command (#12238)
XREAD only supports a special ID of $ and XREADGROUP only supports ^. make sure not to suggest the wrong one when rerunning an error about unbalanced ID arguments Co-authored-by: Oran Agra <oran@redislabs.com>
This commit is contained in:
parent
cb78acb865
commit
1a188e4ed6
@ -2208,9 +2208,10 @@ void xreadCommand(client *c) {
|
||||
streams_arg = i+1;
|
||||
streams_count = (c->argc-streams_arg);
|
||||
if ((streams_count % 2) != 0) {
|
||||
char symbol = xreadgroup ? '>' : '$';
|
||||
addReplyErrorFormat(c,"Unbalanced '%s' list of streams: "
|
||||
"for each stream key an ID or '>' must be "
|
||||
"specified.", c->cmd->fullname);
|
||||
"for each stream key an ID or '%c' must be "
|
||||
"specified.", c->cmd->fullname,symbol);
|
||||
return;
|
||||
}
|
||||
streams_count /= 2; /* We have two arguments for each stream. */
|
||||
|
@ -314,6 +314,14 @@ start_server {
|
||||
$rd close
|
||||
} {0} {external:skip}
|
||||
|
||||
test {XREAD and XREADGROUP against wrong parameter} {
|
||||
r DEL mystream
|
||||
r XADD mystream 666 f v
|
||||
r XGROUP CREATE mystream mygroup $
|
||||
assert_error "ERR Unbalanced 'xreadgroup' list of streams: for each stream key an ID or '>' must be specified." {r XREADGROUP GROUP mygroup Alice COUNT 1 STREAMS mystream }
|
||||
assert_error "ERR Unbalanced 'xread' list of streams: for each stream key an ID or '$' must be specified." {r XREAD COUNT 1 STREAMS mystream }
|
||||
}
|
||||
|
||||
test {Blocking XREAD: key deleted} {
|
||||
r DEL mystream
|
||||
r XADD mystream 666 f v
|
||||
|
Loading…
x
Reference in New Issue
Block a user