mirror of
https://github.com/hanzokv/go.git
synced 2026-09-24 00:31:51 +00:00
When a Lua script containing a write command is executed against a read-only replica in a Redis Cluster, the error may contain "-READONLY You can't write against a read only replica" embedded within a larger error message rather than starting with "READONLY ". The existing code only checked for the "READONLY " prefix, missing this format. This caused shouldRetry() and isReadOnlyError() to fail, preventing automatic retry and connection pool cleanup. The fix checks for the exact substring "-READONLY You can't write against a read only replica" which is specific enough to avoid false positives while catching the Lua script error format. Closes #2770 Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>