summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Benoish <guy.benoish@redislabs.com>2020-02-19 08:24:20 +0530
committerGuy Benoish <guy.benoish@redislabs.com>2020-02-19 08:25:31 +0530
commit770cb0ba97974623808f04de8549b509779bb645 (patch)
tree7454ea027f2dc4a8a0e3795b7e761db5264662c4
parentdf45fed050d6822dc86796b0089aaf1b56c7830e (diff)
downloadredis-770cb0ba97974623808f04de8549b509779bb645.tar.gz
XGROUP DESTROY should unblock XREADGROUP with -NOGROUP
-rw-r--r--src/t_stream.c2
-rw-r--r--tests/unit/type/stream-cgroups.tcl9
2 files changed, 11 insertions, 0 deletions
diff --git a/src/t_stream.c b/src/t_stream.c
index 0f0f97a1d..900fa3a17 100644
--- a/src/t_stream.c
+++ b/src/t_stream.c
@@ -1850,6 +1850,8 @@ NULL
server.dirty++;
notifyKeyspaceEvent(NOTIFY_STREAM,"xgroup-destroy",
c->argv[2],c->db->id);
+ /* We want to unblock any XREADGROUP consumers with -NOGROUP. */
+ signalKeyAsReady(c->db,c->argv[2]);
} else {
addReply(c,shared.czero);
}
diff --git a/tests/unit/type/stream-cgroups.tcl b/tests/unit/type/stream-cgroups.tcl
index a59e168ef..072ed14d6 100644
--- a/tests/unit/type/stream-cgroups.tcl
+++ b/tests/unit/type/stream-cgroups.tcl
@@ -161,6 +161,15 @@ start_server {
assert {[$rd read] == {}} ;# before the fix, client didn't even block, but was served synchronously with {mystream {}}
}
+ test {XGROUP DESTROY should unblock XREADGROUP with -NOGROUP} {
+ r del mystream
+ r XGROUP CREATE mystream mygroup $ MKSTREAM
+ set rd [redis_deferring_client]
+ $rd XREADGROUP GROUP mygroup Alice BLOCK 100 STREAMS mystream ">"
+ r XGROUP DESTROY mystream mygroup
+ assert_error "*NOGROUP*" {$rd read}
+ }
+
test {XCLAIM can claim PEL items from another consumer} {
# Add 3 items into the stream, and create a consumer group
r del mystream