diff --git a/go/logic/inspect.go b/go/logic/inspect.go index a6ecd3d..fb77746 100644 --- a/go/logic/inspect.go +++ b/go/logic/inspect.go @@ -11,6 +11,7 @@ import ( "reflect" "strings" "sync/atomic" + "time" "github.com/github/gh-ost/go/base" "github.com/github/gh-ost/go/mysql" @@ -690,3 +691,12 @@ func (this *Inspector) getMasterConnectionConfig() (applierConfig *mysql.Connect visitedKeys := mysql.NewInstanceKeyMap() return mysql.GetMasterConnectionConfigSafe(this.connectionConfig, visitedKeys, this.migrationContext.AllowedMasterMaster) } + +func (this *Inspector) getReplicationLag() (replicationLag time.Duration, err error) { + replicationLagQuery := this.migrationContext.GetReplicationLagQuery() + replicationLag, err = mysql.GetReplicationLag( + this.migrationContext.InspectorConnectionConfig, + replicationLagQuery, + ) + return replicationLag, err +} diff --git a/go/logic/migrator.go b/go/logic/migrator.go index 34728c8..88f5423 100644 --- a/go/logic/migrator.go +++ b/go/logic/migrator.go @@ -291,7 +291,8 @@ func (this *Migrator) Migrate() (err error) { return err } - log.Infof("Waiting for ghost table to be migrated") + initialLag, _ := this.inspector.getReplicationLag() + log.Infof("Waiting for ghost table to be migrated. Current lag is %+v", initialLag) <-this.ghostTableMigrated log.Debugf("ghost table migrated") // Yay! We now know the Ghost and Changelog tables are good to examine!