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

Support manually specify backup candidate node #843

Open
drivebyer opened this issue Aug 26, 2022 · 0 comments · May be fixed by #861
Open

Support manually specify backup candidate node #843

drivebyer opened this issue Aug 26, 2022 · 0 comments · May be fixed by #861

Comments

@drivebyer
Copy link
Contributor

drivebyer commented Aug 26, 2022

Now, the backup candidate node is calculate by:

// getBackupCandidate returns the hostname of the first not-lagged and
// replicating slave node, else returns the master node.
func (s *jobSyncer) getBackupCandidate() string {
for _, node := range s.cluster.Status.Nodes {
master := s.cluster.GetNodeCondition(node.Name, api.NodeConditionMaster)
replicating := s.cluster.GetNodeCondition(node.Name, api.NodeConditionReplicating)
lagged := s.cluster.GetNodeCondition(node.Name, api.NodeConditionLagged)
if master == nil || replicating == nil || lagged == nil {
continue
}
isMaster := master.Status == core.ConditionTrue
isReplicating := replicating.Status == core.ConditionTrue
isLagged := lagged.Status == core.ConditionTrue
// select a node that is not master is replicating and is not lagged
if !isMaster && isReplicating && !isLagged {
return node.Name
}
}
log.Info("no healthy slave node found so returns the master node", "master_node", s.cluster.GetMasterHost(),
"key", s.cluster, "backup", s.backup)
return s.cluster.GetMasterHost()
}

In some cases, we need backup spcify node, for example:

  1. a node is created only for backup or
  2. a node has less stress which is more suitable for backup

So, I think we should support manually specify backup candidate node to cover more backup scenario

@drivebyer drivebyer linked a pull request Oct 25, 2022 that will close this issue
1 task
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

Successfully merging a pull request may close this issue.

1 participant