Merge pull request #306 from github/check-lag-on-starting
reading and reporting replication lag before waiting on initial repli…
This commit is contained in:
commit
2771232589
@ -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
|
||||
}
|
||||
|
@ -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!
|
||||
|
Loading…
Reference in New Issue
Block a user