Skip to content
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

读主库问题排查 #203

Open
WiFeng opened this issue Apr 24, 2020 · 0 comments
Open

读主库问题排查 #203

WiFeng opened this issue Apr 24, 2020 · 0 comments

Comments

@WiFeng
Copy link

WiFeng commented Apr 24, 2020

在线上配置 mysql-proxy 后,发现有 1%的 SELECT 读请求转发到了 master,但是并没有使用事务、也没有配置 auto-commit 值。

翻阅各种文档以及源码,最后发现 INSERT 后的第一条 SELECT 会转发到 master 节点上。
如下图:
image

但是,仍未理解为什么 INSERT 之后要这么处理,等有时间再进一步分析。目前,如果发现部分耗时的 SQL 请求到 master 时,我们可以在 INSERT 之后强制执行一个 SELECT 1 这样的语句来绕开这个问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant