This commit is contained in:
cjx-zar 2026-02-04 04:52:40 +07:00 committed by GitHub
commit 4fff92f7d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View file

@ -1245,8 +1245,9 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in
margv = pcmd->argv;
/* Only valid for sharded pubsub as regular pubsub can operate on any node and bypasses this layer. */
if (!pubsubshard_included &&
doesCommandHaveChannelsWithFlags(mcmd, CMD_CHANNEL_PUBLISH | CMD_CHANNEL_SUBSCRIBE))
if (!pubsubshard_included && (mcmd->proc == ssubscribeCommand ||
mcmd->proc == sunsubscribeCommand ||
mcmd->proc == spublishCommand))
{
pubsubshard_included = 1;
}

View file

@ -64,4 +64,12 @@ start_cluster 1 1 {tags {external:skip cluster}} {
catch {[$replica EXEC]} err
assert_match {EXECABORT*} $err
}
test "Sharded pubsub sunsubscribe behavior on replica" {
$replica SUNSUBSCRIBE foo
$replica MULTI
$replica SUNSUBSCRIBE foo
$replica EXEC
}
}