Redis - Fix “ERR CLIENT CACHING YES” Error in Client Tracking BCAST Mode:

Update client command processing code to allow “CLIENT CACHING YES” in OPTIN OR BCAST mode.

Bug:
When using the redis client libraries such as rueidis and go-redis in Broadcast mode, the Redis server responds with the following error: “ERR CLIENT CACHING YES is only valid when tracking is enabled in OPTIN mode.” Redis and the client continue to work correctly and the client does not detect this error. However, the error count in INFO ERRORSTATS (server) increases.

Fix:
Update the redis Client Command processing code to allow “CLIENT CACHING YES” to be run in both “CLIENT TRACKING OPTIN” and “CLIENT TRACKING BCAST” mode. This change only alters the error reply behavior and not the client tracking logic, which was working as expected.

Signed-off-by: Danno Tripp <danno.tripp@reddit.com>
This commit is contained in:
Danno Tripp 2025-03-12 20:33:14 -07:00
parent b704179f15
commit 7aad17dd0d

View file

@ -3764,7 +3764,7 @@ NULL
char *opt = c->argv[2]->ptr;
if (!strcasecmp(opt,"yes")) {
if (c->flags & CLIENT_TRACKING_OPTIN) {
if (c->flags & CLIENT_TRACKING_OPTIN || c->flags & CLIENT_TRACKING_BCAST) {
c->flags |= CLIENT_TRACKING_CACHING;
} else {
addReplyError(c,"CLIENT CACHING YES is only valid when tracking is enabled in OPTIN mode.");