You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RedisCluster: directed rawCommand() may be routed to a replica under FAILOVER_DISTRIBUTE #3017
Follow-up to #2890. b30ced7 fixed flushdb() and flushall(), but node-directed rawCommand() still inherits a stale c->readonly from the previous read. With FAILOVER_DISTRIBUTE or FAILOVER_DISTRIBUTE_SLAVES, it can be sent to a replica of the given node.
Expected behaviour
rawCommand($master, ...) is sent to $master, like flushdb($master).
Actual behaviour
After a read, it's sent to a replica of $master. FLUSHDB is rejected with READONLY You can't write against a read only replica. and rawCommand() returns false.
PHP_METHOD(RedisCluster, rawcommand) never sets c->readonly, so cluster_sock_write() uses the value left by the previous command. Setting c->readonly = 0 there, as cluster_flush_cmd() now does, would fix it.
Activity
cluster: Create a readonly command lookup table