Skip to content

Commit 6b21ade

Browse files
committed
Check for --test-on-replica-skip-replica-stop in cutOver method
1 parent 2e43718 commit 6b21ade

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

go/logic/applier.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -568,15 +568,11 @@ func (this *Applier) StartSlaveSQLThread() error {
568568

569569
// StopReplication is used by `--test-on-replica` and stops replication.
570570
func (this *Applier) StopReplication() error {
571-
if this.migrationContext.TestOnReplicaSkipReplicaStop {
572-
log.Warningf("--test-on-replica-skip-replica-stop enabled, we are not stopping replication.")
573-
} else {
574-
if err := this.StopSlaveIOThread(); err != nil {
575-
return err
576-
}
577-
if err := this.StopSlaveSQLThread(); err != nil {
578-
return err
579-
}
571+
if err := this.StopSlaveIOThread(); err != nil {
572+
return err
573+
}
574+
if err := this.StopSlaveSQLThread(); err != nil {
575+
return err
580576
}
581577

582578
readBinlogCoordinates, executeBinlogCoordinates, err := mysql.GetReplicationBinlogCoordinates(this.db)

go/logic/migrator.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,14 @@ func (this *Migrator) cutOver() (err error) {
477477
// the same cut-over phase as the master would use. That means we take locks
478478
// and swap the tables.
479479
// The difference is that we will later swap the tables back.
480-
log.Debugf("testing on replica. Stopping replication IO thread")
481-
if err := this.retryOperation(this.applier.StopReplication); err != nil {
482-
return err
480+
481+
if this.migrationContext.TestOnReplicaSkipReplicaStop {
482+
log.Warningf("--test-on-replica-skip-replica-stop enabled, we are not stopping replication.")
483+
} else {
484+
log.Debugf("testing on replica. Stopping replication IO thread")
485+
if err := this.retryOperation(this.applier.StopReplication); err != nil {
486+
return err
487+
}
483488
}
484489
// We're merly testing, we don't want to keep this state. Rollback the renames as possible
485490
defer this.applier.RenameTablesRollback()

0 commit comments

Comments
 (0)