Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion go/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ type Configuration struct {
GraphitePollSeconds int // Graphite writes interval. 0 disables.
URLPrefix string // URL prefix to run orchestrator on non-root web path, e.g. /orchestrator to put it behind nginx.
DiscoveryIgnoreReplicaHostnameFilters []string // Regexp filters to apply to prevent auto-discovering new replicas. Usage: unreachable servers due to firewalls, applications which trigger binlog dumps
DiscoveryIgnoreMasterHostnameFilters []string // Regexp filters to apply to prevent auto-discovering a master. Usage: pointing your master temporarily to replicate seom data from external host
DiscoveryIgnoreMasterHostnameFilters []string // Regexp filters to apply to prevent auto-discovering a master. Usage: pointing your master temporarily to replicate some data from external host
DiscoveryIgnoreHostnameFilters []string // Regexp filters to apply to prevent discovering instances of any kind
ConsulAddress string // Address where Consul HTTP api is found. Example: 127.0.0.1:8500
ConsulScheme string // Scheme (http or https) for Consul
Expand All @@ -275,6 +275,9 @@ type Configuration struct {
KVClusterMasterPrefix string // Prefix to use for clusters' masters entries in KV stores (internal, consul, ZK), default: "mysql/master"
WebMessage string // If provided, will be shown on all web pages below the title bar
MaxConcurrentReplicaOperations int // Maximum number of concurrent operations on replicas
EnforceExactSemiSyncReplicas bool // If true, semi-sync replicas will be enabled/disabled to match the wait count in the desired priority order; this applies to LockedSemiSyncMaster and MasterWithTooManySemiSyncReplicas
RecoverLockedSemiSyncMaster bool // If true, orchestrator will recover from a LockedSemiSync state by enabling semi-sync on replicas to match the wait count; this behavior can be overridden by EnforceExactSemiSyncReplicas
ReasonableStaleBinlogCoordinatesSeconds uint // Time to evaluate the LockedSemiSyncHypothesis before triggering the LockedSemiSync analysis; falls back to ReasonableReplicationLagSeconds if not set
}

// ToJSONString will marshal this configuration as JSON
Expand Down Expand Up @@ -446,6 +449,9 @@ func newConfiguration() *Configuration {
KVClusterMasterPrefix: "mysql/master",
WebMessage: "",
MaxConcurrentReplicaOperations: 5,
EnforceExactSemiSyncReplicas: false,
RecoverLockedSemiSyncMaster: false,
ReasonableStaleBinlogCoordinatesSeconds: 0,
}
}

Expand Down
8 changes: 8 additions & 0 deletions go/inst/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const (
AllMasterReplicasNotReplicatingOrDead = "AllMasterReplicasNotReplicatingOrDead"
LockedSemiSyncMasterHypothesis = "LockedSemiSyncMasterHypothesis"
LockedSemiSyncMaster = "LockedSemiSyncMaster"
MasterWithTooManySemiSyncReplicas = "MasterWithTooManySemiSyncReplicas"
MasterWithoutReplicas = "MasterWithoutReplicas"
DeadCoMaster = "DeadCoMaster"
DeadCoMasterAndSomeReplicas = "DeadCoMasterAndSomeReplicas"
Expand Down Expand Up @@ -230,3 +231,10 @@ func (this *ReplicationAnalysis) GetAnalysisInstanceType() AnalysisInstanceType
func ValidSecondsFromSeenToLastAttemptedCheck() uint {
return config.Config.InstancePollSeconds + config.Config.ReasonableInstanceCheckSeconds
}

func ReasonableStaleBinlogCoordinatesSeconds() uint {
if config.Config.ReasonableStaleBinlogCoordinatesSeconds == 0 {
return uint(config.Config.ReasonableReplicationLagSeconds)
}
return config.Config.ReasonableStaleBinlogCoordinatesSeconds
}
6 changes: 5 additions & 1 deletion go/inst/analysis_dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func initializeAnalysisDaoPostConfiguration() {
func GetReplicationAnalysis(clusterName string, hints *ReplicationAnalysisHints) ([]ReplicationAnalysis, error) {
result := []ReplicationAnalysis{}

args := sqlutils.Args(config.Config.ReasonableReplicationLagSeconds, ValidSecondsFromSeenToLastAttemptedCheck(), config.Config.ReasonableReplicationLagSeconds, clusterName)
args := sqlutils.Args(ReasonableStaleBinlogCoordinatesSeconds(), ValidSecondsFromSeenToLastAttemptedCheck(), config.Config.ReasonableReplicationLagSeconds, clusterName)
analysisQueryReductionClause := ``

if config.Config.ReduceReplicationAnalysisCount {
Expand Down Expand Up @@ -531,6 +531,10 @@ func GetReplicationAnalysis(clusterName string, hints *ReplicationAnalysisHints)
a.Description = "Semi sync master seems to be locked, more samplings needed to validate"
}
//
} else if config.Config.EnforceExactSemiSyncReplicas && a.IsMaster && a.SemiSyncMasterEnabled && a.SemiSyncMasterStatus && a.SemiSyncMasterWaitForReplicaCount > 0 && a.SemiSyncMasterClients > a.SemiSyncMasterWaitForReplicaCount {
a.Analysis = MasterWithTooManySemiSyncReplicas
a.Description = "Semi sync master has more semi sync replicas than configured"
//
} else if a.IsMaster && a.LastCheckValid && a.IsReadOnly && a.CountValidReplicatingReplicas > 0 && config.Config.RecoverNonWriteableMaster {
a.Analysis = NoWriteableMasterStructureWarning
a.Description = "Master with replicas is read_only"
Expand Down
2 changes: 1 addition & 1 deletion go/inst/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ type Instance struct {
HasReplicationCredentials bool
ReplicationCredentialsAvailable bool
SemiSyncAvailable bool // when both semi sync plugins (master & replica) are loaded
SemiSyncEnforced bool
SemiSyncPriority uint
SemiSyncMasterEnabled bool
SemiSyncReplicaEnabled bool
SemiSyncMasterTimeout uint64
Expand Down
6 changes: 3 additions & 3 deletions go/inst/instance_dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ func ReadTopologyInstanceBufferable(instanceKey *InstanceKey, bufferWrites bool,
waitGroup.Add(1)
go func() {
defer waitGroup.Done()
err := db.QueryRow(config.Config.DetectSemiSyncEnforcedQuery).Scan(&instance.SemiSyncEnforced)
err := db.QueryRow(config.Config.DetectSemiSyncEnforcedQuery).Scan(&instance.SemiSyncPriority)
logReadTopologyInstanceError(instanceKey, "DetectSemiSyncEnforcedQuery", err)
}()
}
Expand Down Expand Up @@ -1209,7 +1209,7 @@ func readInstanceRow(m sqlutils.RowMap) *Instance {
instance.DataCenter = m.GetString("data_center")
instance.Region = m.GetString("region")
instance.PhysicalEnvironment = m.GetString("physical_environment")
instance.SemiSyncEnforced = m.GetBool("semi_sync_enforced")
instance.SemiSyncPriority = m.GetUint("semi_sync_enforced")
instance.SemiSyncAvailable = m.GetBool("semi_sync_available")
instance.SemiSyncMasterEnabled = m.GetBool("semi_sync_master_enabled")
instance.SemiSyncMasterTimeout = m.GetUint64("semi_sync_master_timeout")
Expand Down Expand Up @@ -2610,7 +2610,7 @@ func mkInsertOdkuForInstances(instances []*Instance, instanceWasActuallyFound bo
args = append(args, instance.ReplicationCredentialsAvailable)
args = append(args, instance.HasReplicationCredentials)
args = append(args, instance.AllowTLS)
args = append(args, instance.SemiSyncEnforced)
args = append(args, instance.SemiSyncPriority)
args = append(args, instance.SemiSyncAvailable)
args = append(args, instance.SemiSyncMasterEnabled)
args = append(args, instance.SemiSyncMasterTimeout)
Expand Down
Loading