Skip to content

Commit 8ee0457

Browse files
committed
Use target credentials for control-replica throttling in move-tables mode
1 parent ea1ac30 commit 8ee0457

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

go/cmd/gh-ost/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func main() {
134134

135135
maxLagMillis := flag.Int64("max-lag-millis", 1500, "replication lag at which to throttle operation")
136136
replicationLagQuery := flag.String("replication-lag-query", "", "Deprecated. gh-ost uses an internal, subsecond resolution query")
137-
throttleControlReplicas := flag.String("throttle-control-replicas", "", "List of replicas on which to check for lag; comma delimited. Example: myhost1.com:3306,myhost2.com,myhost3.com:3307")
137+
throttleControlReplicas := flag.String("throttle-control-replicas", "", "List of replicas on which to check for lag; comma delimited. Example: myhost1.com:3306,myhost2.com,myhost3.com:3307. In move-tables mode, these replicas are expected to be in the target cluster. Specified target credentials will be used for the connection.")
138138
throttleQuery := flag.String("throttle-query", "", "when given, issued (every second) to check if operation should throttle. Expecting to return zero for no-throttle, >0 for throttle. Query is issued on the migrated server. Make sure this query is lightweight")
139139
throttleHTTP := flag.String("throttle-http", "", "when given, gh-ost checks given URL via HEAD request; any response code other than 200 (OK) causes throttling; make sure it has low latency response")
140140
flag.Int64Var(&migrationContext.ThrottleHTTPIntervalMillis, "throttle-http-interval-millis", 100, "Number of milliseconds to wait before triggering another HTTP throttle check")

go/logic/throttler.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,13 @@ func (thlr *Throttler) collectControlReplicasLag() {
213213
}
214214
lagResults := make(chan *mysql.ReplicationLagResult, instanceKeyMap.Len())
215215
for replicaKey := range *instanceKeyMap {
216-
connectionConfig := thlr.migrationContext.InspectorConnectionConfig.DuplicateCredentials(replicaKey)
216+
var connectionConfig *mysql.ConnectionConfig
217+
if thlr.migrationContext.IsMoveTablesMode() {
218+
connectionConfig = thlr.migrationContext.MoveTables.ConnectionConfig.DuplicateCredentials(replicaKey)
219+
} else {
220+
connectionConfig = thlr.migrationContext.InspectorConnectionConfig.DuplicateCredentials(replicaKey)
221+
}
222+
217223
if err := connectionConfig.RegisterTLSConfig(); err != nil {
218224
return &mysql.ReplicationLagResult{Err: err}
219225
}

0 commit comments

Comments
 (0)