diff --git a/go/logic/migrator.go b/go/logic/migrator.go index 13108bc..89106b7 100644 --- a/go/logic/migrator.go +++ b/go/logic/migrator.go @@ -537,20 +537,19 @@ func (this *Migrator) cutOver() (err error) { } } } - - switch this.migrationContext.CutOverType { - case base.CutOverAtomic: + if this.migrationContext.CutOverType == base.CutOverAtomic { // Atomic solution: we use low timeout and multiple attempts. But for // each failed attempt, we throttle until replication lag is back to normal - err = this.atomicCutOver() - case base.CutOverTwoStep: - err = this.cutOverTwoStep() - default: - return this.migrationContext.Log.Fatalf("Unknown cut-over type: %d; should never get here!", this.migrationContext.CutOverType) + err := this.atomicCutOver() + this.handleCutOverResult(err) + return err } - - this.handleCutOverResult(err) - return err + if this.migrationContext.CutOverType == base.CutOverTwoStep { + err := this.cutOverTwoStep() + this.handleCutOverResult(err) + return err + } + return this.migrationContext.Log.Fatalf("Unknown cut-over type: %d; should never get here!", this.migrationContext.CutOverType) } // Inject the "AllEventsUpToLockProcessed" state hint, wait for it to appear in the binary logs,