-
Notifications
You must be signed in to change notification settings - Fork 814
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
[mysql] Fix slave_running for mysql 5.7 with slave binlog #2610
Conversation
When a MySQL 5.7 is a slave _and_ has a running binlog with no downstream slaves attached, this check assumed that the instance was a master with no running slaves. Fix it so that it checks for Slave_IO_Running and Slave_SQL_Running before checking for Binlog_enabled and Slaves_connected. [mysql] some more PR fixes.
@nrw505 this would be the rebased PR. I believe it respect your changes to the logic and authorship. Thanks for your contribution. |
|
||
# if we don't yet have a status - inspect | ||
if slave_running_status == AgentCheck.UNKNOWN: | ||
if self._is_master(slaves, binlog_running): # master |
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.
On MySQL < 5.7, couldn't the same issue arise here? (i.e. if we have a slave with binlog running, we'd regard it as a master because of this condition and send a WARNING
status)
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.
Well yes - that occurred to me as well - but I don't think there's a clear-cut way of deciding if a certain instance is a master or a slave on earlier versions. One option could be setting it in the config 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.
An optional setting in the conf file sounds good to me! (for instance an option to force the check to regard the server as a master even when binlog is running)
@truthbk Added in one comment, let me know what you think :) |
LGTM! (my comment about mysql < 5.7 can be addressed later in a separate PR, feel free to merge this PR) |
When a MySQL 5.7 is a slave and has a running binlog with no
downstream slaves attached, this check assumed that the instance was a
master with no running slaves.
Fix it so that it checks for Slave_IO_Running and Slave_SQL_Running
before checking for Binlog_enabled and Slaves_connected.
This PR should supersede #2493 - it is essentially no more than a rebase of it. We first look at the slave variables available in most 5.7+ versions, and if we don't yet have concluded on a status, we then look at possible master, slave combinations.