Repository navigation
redis: close the connection on READONLY replies to pipelined commands - #1297
Open
OS-diogofernandes wants to merge 1 commit into
Open
OS-diogofernandes wants to merge 1 commit into
OS-diogofernandes wants to merge 1 commit into
Conversation
OS-diogofernandes
marked this pull request as ready for review
November 4, 2026 15:49
REDIS_CLOSE_CONNECTION_ON_READONLY_ERROR does not apply to pipelines. radix keeps the error of each pipelined command on the command and returns nil to the connection, so readOnlyClosingConn never sees the READONLY reply and the pool keeps the connection to the demoted server. Counters are written with a pipelined INCRBY and EXPIRE, so after a failover that leaves the old master running, every write keeps failing until the service restarts. Add a pipeline action that returns resp.ErrConnUnusable when a reply is READONLY, and use it in single and sentinel mode when the option is on. Cluster mode is unchanged. Signed-off-by: Diogo Fernandes <diogo.fernandes@outsystems.com>
OS-diogofernandes
force-pushed
the
readonly-pipeline-close-conn
branch
from
November 4, 2026 15:56
c0864c9 to
a66c4ba
Compare
Author
|
Hello @envoyproxy/ratelimit-maintainers (@agrawroh, @collin-lee), can you take a look at this PR? Thank you |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
REDIS_CLOSE_CONNECTION_ON_READONLY_ERROR(#1191) has no effect on pipelined commands, which is how the counters are written (INCRBY+EXPIRE). radix keeps each command's error on the command and returns nil to the connection, soreadOnlyClosingConnnever sees theREADONLYreply and the pool keeps reusing the connection to the demoted server.This adds a pipeline action that returns
resp.ErrConnUnusableon aREADONLYreply, so the pool discards the connection. It is used in single and sentinel mode when the option is on; nothing changes when it is off.Notes:
Related: #1256, an earlier draft for the same problem.