File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -649,17 +649,17 @@ func (this *Applier) DropTriggersOldTable() error {
649649 prefix := this .makeTriggerPrefix ()
650650
651651 dropDeleteTrigger := fmt .Sprintf (
652- "DROP /* gh-ost */ TRIGGER %s.`%s_del`" ,
652+ "DROP /* gh-ost */ TRIGGER IF EXISTS %s.`%s_del`" ,
653653 sql .EscapeName (this .migrationContext .DatabaseName ),
654654 prefix )
655655
656656 dropInsertTrigger := fmt .Sprintf (
657- "DROP /* gh-ost */ TRIGGER %s.`%s_ins`" ,
657+ "DROP /* gh-ost */ TRIGGER IF EXISTS %s.`%s_ins`" ,
658658 sql .EscapeName (this .migrationContext .DatabaseName ),
659659 prefix )
660660
661661 dropUpdateTrigger := fmt .Sprintf (
662- "DROP /* gh-ost */ TRIGGER %s.`%s_upd`" ,
662+ "DROP /* gh-ost */ TRIGGER IF EXISTS %s.`%s_upd`" ,
663663 sql .EscapeName (this .migrationContext .DatabaseName ),
664664 prefix )
665665
Original file line number Diff line number Diff line change @@ -100,6 +100,7 @@ func NewMigrator(context *base.MigrationContext) *Migrator {
100100 firstThrottlingCollected : make (chan bool , 3 ),
101101 rowCopyComplete : make (chan error ),
102102 allEventsUpToLockProcessed : make (chan string ),
103+ stoppedBinlogWrites : make (chan bool ),
103104 allEventsUpToTriggersProcessed : make (chan string ),
104105
105106 copyRowsQueue : make (chan tableWriteFunc ),
@@ -692,6 +693,8 @@ func (this *Migrator) cutOverTrigger() (err error) {
692693
693694 this .waitForStopWrites ()
694695
696+ defer this .applier .DropTriggersOldTable ()
697+
695698 log .Infof (
696699 "Creating triggers for %s.%s" ,
697700 this .migrationContext .DatabaseName ,
You can’t perform that action at this time.
0 commit comments