fix GetReplicationLag not used args
This commit is contained in:
parent
21d455013e
commit
14eda7efe0
@ -758,9 +758,8 @@ func (this *Inspector) getMasterConnectionConfig() (applierConfig *mysql.Connect
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *Inspector) getReplicationLag() (replicationLag time.Duration, err error) {
|
func (this *Inspector) getReplicationLag() (replicationLag time.Duration, err error) {
|
||||||
replicationLag, err = mysql.GetReplicationLag(
|
replicationLag, err = mysql.GetReplicationLagFromSlaveStatus(
|
||||||
this.informationSchemaDb,
|
this.informationSchemaDb,
|
||||||
this.migrationContext.InspectorConnectionConfig,
|
|
||||||
)
|
)
|
||||||
return replicationLag, err
|
return replicationLag, err
|
||||||
}
|
}
|
||||||
|
@ -140,8 +140,8 @@ func (this *Throttler) collectReplicationLag(firstThrottlingCollected chan<- boo
|
|||||||
if this.migrationContext.TestOnReplica || this.migrationContext.MigrateOnReplica {
|
if this.migrationContext.TestOnReplica || this.migrationContext.MigrateOnReplica {
|
||||||
// when running on replica, the heartbeat injection is also done on the replica.
|
// when running on replica, the heartbeat injection is also done on the replica.
|
||||||
// This means we will always get a good heartbeat value.
|
// This means we will always get a good heartbeat value.
|
||||||
// When runnign on replica, we should instead check the `SHOW SLAVE STATUS` output.
|
// When running on replica, we should instead check the `SHOW SLAVE STATUS` output.
|
||||||
if lag, err := mysql.GetReplicationLag(this.inspector.informationSchemaDb, this.inspector.connectionConfig); err != nil {
|
if lag, err := mysql.GetReplicationLagFromSlaveStatus(this.inspector.informationSchemaDb); err != nil {
|
||||||
return log.Errore(err)
|
return log.Errore(err)
|
||||||
} else {
|
} else {
|
||||||
atomic.StoreInt64(&this.migrationContext.CurrentLag, int64(lag))
|
atomic.StoreInt64(&this.migrationContext.CurrentLag, int64(lag))
|
||||||
|
@ -57,9 +57,8 @@ func GetDB(migrationUuid string, mysql_uri string) (*gosql.DB, bool, error) {
|
|||||||
return knownDBs[cacheKey], exists, nil
|
return knownDBs[cacheKey], exists, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetReplicationLag returns replication lag for a given connection config; either by explicit query
|
// GetReplicationLagFromSlaveStatus returns replication lag for a given db; via SHOW SLAVE STATUS
|
||||||
// or via SHOW SLAVE STATUS
|
func GetReplicationLagFromSlaveStatus(informationSchemaDb *gosql.DB) (replicationLag time.Duration, err error) {
|
||||||
func GetReplicationLag(informationSchemaDb *gosql.DB, connectionConfig *ConnectionConfig) (replicationLag time.Duration, err error) {
|
|
||||||
err = sqlutils.QueryRowsMap(informationSchemaDb, `show slave status`, func(m sqlutils.RowMap) error {
|
err = sqlutils.QueryRowsMap(informationSchemaDb, `show slave status`, func(m sqlutils.RowMap) error {
|
||||||
slaveIORunning := m.GetString("Slave_IO_Running")
|
slaveIORunning := m.GetString("Slave_IO_Running")
|
||||||
slaveSQLRunning := m.GetString("Slave_SQL_Running")
|
slaveSQLRunning := m.GetString("Slave_SQL_Running")
|
||||||
|
Loading…
Reference in New Issue
Block a user