Check for --test-on-replica-skip-replica-stop in cutOver method
This commit is contained in:
parent
2e43718ef3
commit
6b21ade6d0
@ -568,16 +568,12 @@ func (this *Applier) StartSlaveSQLThread() error {
|
|||||||
|
|
||||||
// StopReplication is used by `--test-on-replica` and stops replication.
|
// StopReplication is used by `--test-on-replica` and stops replication.
|
||||||
func (this *Applier) StopReplication() error {
|
func (this *Applier) StopReplication() error {
|
||||||
if this.migrationContext.TestOnReplicaSkipReplicaStop {
|
|
||||||
log.Warningf("--test-on-replica-skip-replica-stop enabled, we are not stopping replication.")
|
|
||||||
} else {
|
|
||||||
if err := this.StopSlaveIOThread(); err != nil {
|
if err := this.StopSlaveIOThread(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := this.StopSlaveSQLThread(); err != nil {
|
if err := this.StopSlaveSQLThread(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
readBinlogCoordinates, executeBinlogCoordinates, err := mysql.GetReplicationBinlogCoordinates(this.db)
|
readBinlogCoordinates, executeBinlogCoordinates, err := mysql.GetReplicationBinlogCoordinates(this.db)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -477,10 +477,15 @@ func (this *Migrator) cutOver() (err error) {
|
|||||||
// the same cut-over phase as the master would use. That means we take locks
|
// the same cut-over phase as the master would use. That means we take locks
|
||||||
// and swap the tables.
|
// and swap the tables.
|
||||||
// The difference is that we will later swap the tables back.
|
// The difference is that we will later swap the tables back.
|
||||||
|
|
||||||
|
if this.migrationContext.TestOnReplicaSkipReplicaStop {
|
||||||
|
log.Warningf("--test-on-replica-skip-replica-stop enabled, we are not stopping replication.")
|
||||||
|
} else {
|
||||||
log.Debugf("testing on replica. Stopping replication IO thread")
|
log.Debugf("testing on replica. Stopping replication IO thread")
|
||||||
if err := this.retryOperation(this.applier.StopReplication); err != nil {
|
if err := this.retryOperation(this.applier.StopReplication); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// We're merly testing, we don't want to keep this state. Rollback the renames as possible
|
// We're merly testing, we don't want to keep this state. Rollback the renames as possible
|
||||||
defer this.applier.RenameTablesRollback()
|
defer this.applier.RenameTablesRollback()
|
||||||
// We further proceed to do the cutover by normal means; the 'defer' above will rollback the swap
|
// We further proceed to do the cutover by normal means; the 'defer' above will rollback the swap
|
||||||
|
Loading…
Reference in New Issue
Block a user