-
-
Notifications
You must be signed in to change notification settings - Fork 279
Open
Description
Now, the backup candidate node is calculate by:
mysql-operator/pkg/controller/mysqlbackup/internal/syncer/job.go
Lines 91 to 116 in d5d4981
// 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:
- a node is created only for backup or
- 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
Metadata
Metadata
Assignees
Labels
No labels