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

[mysql] Fix slave_running for mysql 5.7 with slave binlog #2610

Merged
merged 1 commit into from
Jun 22, 2016

Conversation

truthbk
Copy link
Member

@truthbk truthbk commented Jun 20, 2016

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.

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.
@truthbk truthbk added this to the 5.8.4 milestone Jun 20, 2016
@truthbk truthbk self-assigned this Jun 20, 2016
@truthbk
Copy link
Member Author

truthbk commented Jun 20, 2016

@nrw505 this would be the rebased PR. I believe it respect your changes to the logic and authorship.

Thanks for your contribution.

@olivielpeau olivielpeau assigned olivielpeau and unassigned truthbk Jun 20, 2016

# if we don't yet have a status - inspect
if slave_running_status == AgentCheck.UNKNOWN:
if self._is_master(slaves, binlog_running): # master
Copy link
Member

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)

Copy link
Member Author

@truthbk truthbk Jun 20, 2016

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.

Copy link
Member

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)

@olivielpeau
Copy link
Member

@truthbk Added in one comment, let me know what you think :)

@olivielpeau
Copy link
Member

LGTM!

(my comment about mysql < 5.7 can be addressed later in a separate PR, feel free to merge this PR)

@truthbk truthbk merged commit fe83287 into master Jun 22, 2016
@truthbk truthbk deleted the jaime/mysql_fix2 branch June 22, 2016 12:42
@truthbk truthbk modified the milestones: 5.8.3, 5.8.4 Jun 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants