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

Should set old master's read_only to false under DeadCoMaster failure #1480

Open
ZhangJiaQiao opened this issue Mar 16, 2023 · 0 comments
Open

Comments

@ZhangJiaQiao
Copy link

ZhangJiaQiao commented Mar 16, 2023

There is an attempt of setting old master's read_only to false while recovering DeadMaster failure, but there is no such operation for DeadCoMaster failure, which is not reasonable. See the code below:

DeadMaster

{
_, err := inst.SetReadOnly(&promotedReplica.Key, false)
AuditTopologyRecovery(topologyRecovery, fmt.Sprintf("- RecoverDeadMaster: applying read-only=0 on promoted master: success=%t", (err == nil)))
}
// Let's attempt, though we won't necessarily succeed, to set old master as read-only
go func() {
_, err := inst.SetReadOnly(&analysisEntry.AnalyzedInstanceKey, true)
AuditTopologyRecovery(topologyRecovery, fmt.Sprintf("- RecoverDeadMaster: applying read-only=1 on demoted master: success=%t", (err == nil)))
}()

DeadCoMaster

if config.Config.ApplyMySQLPromotionAfterMasterFailover {
AuditTopologyRecovery(topologyRecovery, fmt.Sprintf("- RecoverDeadMaster: will apply MySQL changes to promoted master"))
inst.SetReadOnly(&promotedReplica.Key, false)
}

Old master is supposed to be dead and should not accept new write requests. If we don't try to set old master's read_only to false and the master is not dead completely, there might be living connections still accepting new write requests. When there is only one master is allowed to accept write requests for some purposes, such as generating auto-increment id for new records, the living connections of the old master might still accept new write requests and its data will be conflict with the new master's.

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