-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add error 1290/ER_READ_ONLY_MODE to rejectReadOnly handling #1660
Conversation
WalkthroughThe pull request modifies the error handling logic in the Changes
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packets.go (1)
577-578
: LGTM! Good addition to handle read-only mode errors.The addition of error code 1836 (ER_READ_ONLY_MODE) enhances the robustness of read-only error handling, particularly during failover scenarios. This complements the existing handling of ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION (1792) and ER_OPTION_PREVENTS_STATEMENT (1290) errors.
This change improves reliability during database failovers by ensuring that connections are properly recycled when they become read-only, which is particularly important for applications using Aurora or other managed MySQL services with automatic failover capabilities.
Would you explain when the ER_READ_ONLY_MODE is returned by MySQL/MariaDB? |
There are a number of situations where InnoDB will issue a ER_READ_ONLY_MODE error when
|
Is it relating to fail over? |
Yeah, we're using Aurora and we've seen some cases (not reproducible) where the server is sending ER_READ_ONLY_MODE to the client. We want to reject the read-only connection in those cases and force a reconnect to the writer endpoint. |
I have not checked aurora behavior. But aurora replica sets |
Description
Please explain the changes you made here.
Checklist
Summary by CodeRabbit