Skip to content

Commit 1e1fbcb

Browse files
Ensure -attempt-instant-ddl respects -execute flag (#1440)
1 parent 59db6fa commit 1e1fbcb

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

go/logic/migrator.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,16 @@ func (this *Migrator) Migrate() (err error) {
362362
// In MySQL 8.0 (and possibly earlier) some DDL statements can be applied instantly.
363363
// Attempt to do this if AttemptInstantDDL is set.
364364
if this.migrationContext.AttemptInstantDDL {
365-
this.migrationContext.Log.Infof("Attempting to execute alter with ALGORITHM=INSTANT")
366-
if err := this.applier.AttemptInstantDDL(); err == nil {
367-
this.migrationContext.Log.Infof("Success! table %s.%s migrated instantly", sql.EscapeName(this.migrationContext.DatabaseName), sql.EscapeName(this.migrationContext.OriginalTableName))
368-
return nil
365+
if this.migrationContext.Noop {
366+
this.migrationContext.Log.Debugf("Noop operation; not really attempting instant DDL")
369367
} else {
370-
this.migrationContext.Log.Infof("ALGORITHM=INSTANT not supported for this operation, proceeding with original algorithm: %s", err)
368+
this.migrationContext.Log.Infof("Attempting to execute alter with ALGORITHM=INSTANT")
369+
if err := this.applier.AttemptInstantDDL(); err == nil {
370+
this.migrationContext.Log.Infof("Success! table %s.%s migrated instantly", sql.EscapeName(this.migrationContext.DatabaseName), sql.EscapeName(this.migrationContext.OriginalTableName))
371+
return nil
372+
} else {
373+
this.migrationContext.Log.Infof("ALGORITHM=INSTANT not supported for this operation, proceeding with original algorithm: %s", err)
374+
}
371375
}
372376
}
373377

0 commit comments

Comments
 (0)