@@ -475,6 +475,7 @@ func (this *Migrator) cutOver() (err error) {
475
475
}
476
476
// We're merly testing, we don't want to keep this state. Rollback the renames as possible
477
477
defer this .applier .RenameTablesRollback ()
478
+ // We further proceed to do the cutover by normal means; the 'defer' above will rollback the swap
478
479
}
479
480
if this .migrationContext .CutOverType == base .CutOverAtomic {
480
481
// Atomic solution: we use low timeout and multiple attempts. But for
@@ -525,6 +526,7 @@ func (this *Migrator) waitForEventsUpToLock() (err error) {
525
526
func (this * Migrator ) cutOverTwoStep () (err error ) {
526
527
atomic .StoreInt64 (& this .inCutOverCriticalActionFlag , 1 )
527
528
defer atomic .StoreInt64 (& this .inCutOverCriticalActionFlag , 0 )
529
+ atomic .StoreInt64 (& this .allEventsUpToLockProcessedInjectedFlag , 0 )
528
530
529
531
if err := this .retryOperation (this .applier .LockOriginalTable ); err != nil {
530
532
return err
@@ -555,6 +557,8 @@ func (this *Migrator) atomicCutOver() (err error) {
555
557
this .applier .DropAtomicCutOverSentryTableIfExists ()
556
558
}()
557
559
560
+ atomic .StoreInt64 (& this .allEventsUpToLockProcessedInjectedFlag , 0 )
561
+
558
562
lockOriginalSessionIdChan := make (chan int64 , 2 )
559
563
tableLocked := make (chan error , 2 )
560
564
okToUnlockTable := make (chan bool , 3 )
@@ -633,22 +637,6 @@ func (this *Migrator) atomicCutOver() (err error) {
633
637
return nil
634
638
}
635
639
636
- // stopWritesAndCompleteMigrationOnReplica will stop replication IO thread, apply
637
- // what DML events are left, and that's it.
638
- // This only applies in --test-on-replica. It leaves replication stopped, with both tables
639
- // in sync. There is no table swap.
640
- func (this * Migrator ) stopWritesAndCompleteMigrationOnReplica () (err error ) {
641
- log .Debugf ("testing on replica. Instead of LOCK tables I will STOP SLAVE" )
642
- if err := this .retryOperation (this .applier .StopReplication ); err != nil {
643
- return err
644
- }
645
-
646
- this .waitForEventsUpToLock ()
647
-
648
- log .Info ("Table duplicated with new schema. Am not touching the original table. Replication is stopped. You may now compare the two tables to gain trust into this tool's operation" )
649
- return nil
650
- }
651
-
652
640
// onServerCommand responds to a user's interactive command
653
641
func (this * Migrator ) onServerCommand (command string , writer * bufio.Writer ) (err error ) {
654
642
defer writer .Flush ()
0 commit comments