Skip to content

Commit

Permalink
Add WaitForSemiSyncRecoverySeconds config option
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Heckel committed Jul 22, 2021
1 parent 664d3c1 commit 5382128
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion go/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ type Configuration struct {
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
ReasonableLockedSemiSyncMasterSeconds uint // Time to evaluate the LockedSemiSyncHypothesis before triggering the LockedSemiSync analysis; falls back to ReasonableReplicationLagSeconds if not set
ReasonableLockedSemiSyncMasterSeconds uint // Time to evaluate the LockedSemiSyncHypothesis before triggering the LockedSemiSyncMaster analysis; defaults to ReasonableReplicationLagSeconds if not set
WaitForSemiSyncRecoverySeconds uint // Time to wait for a successful recovery of LockedSemiSyncMaster or MasterWithTooManySemiSyncReplicas before considering the recovery failed; defaults to InstancePollSeconds * 3 if not set
}

// ToJSONString will marshal this configuration as JSON
Expand Down Expand Up @@ -452,6 +453,7 @@ func newConfiguration() *Configuration {
EnforceExactSemiSyncReplicas: false,
RecoverLockedSemiSyncMaster: false,
ReasonableLockedSemiSyncMasterSeconds: 0,
WaitForSemiSyncRecoverySeconds: 0,
}
}

Expand Down Expand Up @@ -617,6 +619,9 @@ func (this *Configuration) postReadAdjustments() error {
if this.ReasonableLockedSemiSyncMasterSeconds == 0 {
this.ReasonableLockedSemiSyncMasterSeconds = uint(this.ReasonableReplicationLagSeconds)
}
if this.WaitForSemiSyncRecoverySeconds == 0 {
this.WaitForSemiSyncRecoverySeconds = this.InstancePollSeconds * 3
}

return nil
}
Expand Down
2 changes: 1 addition & 1 deletion go/logic/topology_recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -1548,7 +1548,7 @@ func recoverSemiSyncReplicas(topologyRecovery *TopologyRecovery, analysisEntry i
// Wait for replica count to match desired wait count (this is what triggers the recovery)
AuditTopologyRecovery(topologyRecovery, "semi-sync: waiting for desired state:")
success := false
for i := 0; i < 10; i++ {
for i := uint(0); i < config.Config.WaitForSemiSyncRecoverySeconds; i++ {
masterInstance, err = inst.ReadTopologyInstance(&analysisEntry.AnalyzedInstanceKey)
if err != nil {
return true, topologyRecovery, fmt.Errorf("error re-reading master instance: %s", err.Error())
Expand Down

0 comments on commit 5382128

Please sign in to comment.