Skip to content

Commit

Permalink
use logic.DisableRecovery() to disable
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Vaillancourt <[email protected]>
  • Loading branch information
timvaillancourt committed Feb 13, 2025
1 parent 330cd25 commit acb81d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 7 additions & 0 deletions go/cmd/vtorc/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ func run(cmd *cobra.Command, args []string) {

// Log final config values to debug if something goes wrong.
config.LogConfigValues()
if !config.Config.AllowRecovery {
log.Info("--allow-recoveries is set to false, disabling recoveries")
if err := logic.DisableRecovery(); err != nil {
log.Errorf("failed to disable recoveries: %+v", err)
return
}
}
server.StartVTOrcDiscovery()

server.RegisterVTOrcAPIEndpoints()
Expand Down
9 changes: 2 additions & 7 deletions go/vt/vtorc/logic/vtorc.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,19 +337,14 @@ func ContinuousDiscovery() {

healthTick := time.Tick(config.HealthPollSeconds * time.Second)
caretakingTick := time.Tick(time.Minute)
recoveryTick := time.Tick(time.Duration(config.Config.RecoveryPollSeconds) * time.Second)
tabletTopoTick := OpenTabletDiscovery()
var recoveryEntrance int64
var snapshotTopologiesTick <-chan time.Time
if config.Config.SnapshotTopologiesIntervalHours > 0 {
snapshotTopologiesTick = time.Tick(time.Duration(config.Config.SnapshotTopologiesIntervalHours) * time.Hour)
}

recoveryTicker := time.NewTicker(time.Duration(config.Config.RecoveryPollSeconds) * time.Second)
defer recoveryTicker.Stop()
if !config.Config.AllowRecovery {
recoveryTicker.Stop()
}

runCheckAndRecoverOperationsTimeRipe := func() bool {
return time.Since(continuousDiscoveryStartTime) >= checkAndRecoverWaitPeriod
}
Expand Down Expand Up @@ -383,7 +378,7 @@ func ContinuousDiscovery() {
go ExpireTopologyRecoveryStepsHistory()
}
}()
case <-recoveryTicker.C:
case <-recoveryTick:
go func() {
if IsLeaderOrActive() {
go ClearActiveFailureDetections()
Expand Down

0 comments on commit acb81d7

Please sign in to comment.