@@ -26,7 +26,7 @@ import (
2626type ChangelogState string
2727
2828const (
29- TablesInPlace ChangelogState = "TablesInPlace "
29+ GhostTableMigrated ChangelogState = "GhostTableMigrated "
3030 AllEventsUpToLockProcessed = "AllEventsUpToLockProcessed"
3131)
3232
@@ -58,7 +58,7 @@ type Migrator struct {
5858 migrationContext * base.MigrationContext
5959
6060 firstThrottlingCollected chan bool
61- tablesInPlace chan bool
61+ ghostTableMigrated chan bool
6262 rowCopyComplete chan bool
6363 allEventsUpToLockProcessed chan bool
6464
@@ -76,7 +76,7 @@ func NewMigrator() *Migrator {
7676 migrator := & Migrator {
7777 migrationContext : base .GetMigrationContext (),
7878 parser : sql .NewParser (),
79- tablesInPlace : make (chan bool ),
79+ ghostTableMigrated : make (chan bool ),
8080 firstThrottlingCollected : make (chan bool , 1 ),
8181 rowCopyComplete : make (chan bool ),
8282 allEventsUpToLockProcessed : make (chan bool ),
@@ -182,9 +182,9 @@ func (this *Migrator) onChangelogStateEvent(dmlEvent *binlog.BinlogDMLEvent) (er
182182 }
183183 changelogState := ChangelogState (dmlEvent .NewColumnValues .StringColumn (3 ))
184184 switch changelogState {
185- case TablesInPlace :
185+ case GhostTableMigrated :
186186 {
187- this .tablesInPlace <- true
187+ this .ghostTableMigrated <- true
188188 }
189189 case AllEventsUpToLockProcessed :
190190 {
@@ -291,14 +291,14 @@ func (this *Migrator) Migrate() (err error) {
291291 return err
292292 }
293293
294- log .Infof ("Waiting for tables to be in place " )
295- <- this .tablesInPlace
296- log .Debugf ("Tables are in place " )
294+ log .Infof ("Waiting for ghost table to be migrated " )
295+ <- this .ghostTableMigrated
296+ log .Debugf ("ghost table migrated " )
297297 // Yay! We now know the Ghost and Changelog tables are good to examine!
298298 // When running on replica, this means the replica has those tables. When running
299299 // on master this is always true, of course, and yet it also implies this knowledge
300300 // is in the binlogs.
301- if err := this .inspector .InspectOriginalAndGhostTables (); err != nil {
301+ if err := this .inspector .inspectOriginalAndGhostTables (); err != nil {
302302 return err
303303 }
304304 // Validation complete! We're good to execute this migration
@@ -926,12 +926,13 @@ func (this *Migrator) initiateApplier() error {
926926 log .Errorf ("Unable to create ghost table, see further error details. Perhaps a previous migration failed without dropping the table? Bailing out" )
927927 return err
928928 }
929+
929930 if err := this .applier .AlterGhost (); err != nil {
930931 log .Errorf ("Unable to ALTER ghost table, see further error details. Bailing out" )
931932 return err
932933 }
933934
934- this .applier .WriteChangelogState (string (TablesInPlace ))
935+ this .applier .WriteChangelogState (string (GhostTableMigrated ))
935936 go this .applier .InitiateHeartbeat ()
936937 return nil
937938}
0 commit comments