@@ -351,6 +351,15 @@ func (this *Migrator) Migrate() (err error) {
351
351
if err := this .initiateInspector (); err != nil {
352
352
return err
353
353
}
354
+ if err := this .initiateStreaming (); err != nil {
355
+ return err
356
+ }
357
+ if err := this .initiateApplier (); err != nil {
358
+ return err
359
+ }
360
+ if err := this .createFlagFiles (); err != nil {
361
+ return err
362
+ }
354
363
// In MySQL 8.0 (and possibly earlier) some DDL statements can be applied instantly.
355
364
// Attempt to do this if AttemptInstantDDL is set.
356
365
if this .migrationContext .AttemptInstantDDL {
@@ -363,16 +372,6 @@ func (this *Migrator) Migrate() (err error) {
363
372
}
364
373
}
365
374
366
- if err := this .initiateStreaming (); err != nil {
367
- return err
368
- }
369
- if err := this .initiateApplier (); err != nil {
370
- return err
371
- }
372
- if err := this .createFlagFiles (); err != nil {
373
- return err
374
- }
375
-
376
375
initialLag , _ := this .inspector .getReplicationLag ()
377
376
this .migrationContext .Log .Infof ("Waiting for ghost table to be migrated. Current lag is %+v" , initialLag )
378
377
<- this .ghostTableMigrated
@@ -750,10 +749,6 @@ func (this *Migrator) initiateServer() (err error) {
750
749
// using a ALGORITHM=INSTANT assertion. If this fails, it will return an error,
751
750
// in which case the original algorithm should be used.
752
751
func (this * Migrator ) attemptInstantDDL () (err error ) {
753
- this .applier = NewApplier (this .migrationContext )
754
- if err := this .applier .InitDBConnections (); err != nil {
755
- return err
756
- }
757
752
return this .applier .AttemptInstantDDL ()
758
753
}
759
754
0 commit comments