Skip to content

Commit 3f3a10a

Browse files
committed
Address PR feedback
1 parent cfd8372 commit 3f3a10a

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

go/logic/applier_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,5 +182,4 @@ func TestApplierInstantDDL(t *testing.T) {
182182
stmt := applier.generateInstantDDLQuery()
183183
test.S(t).ExpectEquals(stmt, "ALTER /* gh-ost */ TABLE `test`.`mytable` ADD INDEX (foo), ALGORITHM=INSTANT")
184184
})
185-
186185
}

go/logic/migrator.go

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,15 @@ func (this *Migrator) Migrate() (err error) {
351351
if err := this.initiateInspector(); err != nil {
352352
return err
353353
}
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+
}
354363
// In MySQL 8.0 (and possibly earlier) some DDL statements can be applied instantly.
355364
// Attempt to do this if AttemptInstantDDL is set.
356365
if this.migrationContext.AttemptInstantDDL {
@@ -363,16 +372,6 @@ func (this *Migrator) Migrate() (err error) {
363372
}
364373
}
365374

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-
376375
initialLag, _ := this.inspector.getReplicationLag()
377376
this.migrationContext.Log.Infof("Waiting for ghost table to be migrated. Current lag is %+v", initialLag)
378377
<-this.ghostTableMigrated
@@ -750,10 +749,6 @@ func (this *Migrator) initiateServer() (err error) {
750749
// using a ALGORITHM=INSTANT assertion. If this fails, it will return an error,
751750
// in which case the original algorithm should be used.
752751
func (this *Migrator) attemptInstantDDL() (err error) {
753-
this.applier = NewApplier(this.migrationContext)
754-
if err := this.applier.InitDBConnections(); err != nil {
755-
return err
756-
}
757752
return this.applier.AttemptInstantDDL()
758753
}
759754

0 commit comments

Comments
 (0)