Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant