-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Move Tables: throttle based on target credentials #1709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature-move-tables
Are you sure you want to change the base?
Changes from all commits
67fc504
31067d8
fccd963
913a03c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1636,17 +1636,13 @@ func (mgtr *Migrator) addDMLEventsListener() error { | |
|
|
||
| // initiateThrottler kicks in the throttling collection and the throttling checks. | ||
| func (mgtr *Migrator) initiateThrottler() { | ||
| if mgtr.migrationContext.IsMoveTablesMode() { | ||
| // TODO(chriskirkland): throttle against the target cluster | ||
| mgtr.migrationContext.Log.Info("Skipping throttling in move tables mode") | ||
| return | ||
| } | ||
|
|
||
| mgtr.throttler = NewThrottler(mgtr.migrationContext, mgtr.applier, mgtr.inspector, mgtr.appVersion) | ||
|
|
||
| go mgtr.throttler.initiateThrottlerCollection(mgtr.firstThrottlingCollected) | ||
| mgtr.migrationContext.Log.Infof("Waiting for first throttle metrics to be collected") | ||
| <-mgtr.firstThrottlingCollected // replication lag | ||
| if !mgtr.migrationContext.IsMoveTablesMode() { | ||
| <-mgtr.firstThrottlingCollected // replication lag | ||
| } | ||
| <-mgtr.firstThrottlingCollected // HTTP status | ||
| <-mgtr.firstThrottlingCollected // other, general metrics | ||
|
Comment on lines
+1643
to
1647
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain why only this first There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see down below we aren't emitting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh okay, reading into the code more is this because
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, some of the |
||
| mgtr.migrationContext.Log.Infof("First throttle metrics collected") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -176,6 +176,17 @@ func (thlr *Throttler) collectReplicationLag(firstThrottlingCollected chan<- boo | |
| } | ||
| } | ||
|
|
||
| // controlReplicaConnectionConfig returns the connection config used to read | ||
| // replication lag from a control replica. In move-tables mode the lag is read | ||
| // from the target cluster's replicas, otherwise from the source (inspector) | ||
| // cluster's replicas. | ||
| func (thlr *Throttler) controlReplicaConnectionConfig(replicaKey mysql.InstanceKey) *mysql.ConnectionConfig { | ||
| if thlr.migrationContext.IsMoveTablesMode() { | ||
| return thlr.migrationContext.MoveTables.ConnectionConfig.DuplicateCredentials(replicaKey) | ||
| } | ||
| return thlr.migrationContext.InspectorConnectionConfig.DuplicateCredentials(replicaKey) | ||
| } | ||
|
|
||
| // collectControlReplicasLag polls all the control replicas to get maximum lag value | ||
| func (thlr *Throttler) collectControlReplicasLag() { | ||
| if atomic.LoadInt64(&thlr.migrationContext.HibernateUntil) > 0 { | ||
|
|
@@ -213,7 +224,8 @@ func (thlr *Throttler) collectControlReplicasLag() { | |
| } | ||
| lagResults := make(chan *mysql.ReplicationLagResult, instanceKeyMap.Len()) | ||
| for replicaKey := range *instanceKeyMap { | ||
| connectionConfig := thlr.migrationContext.InspectorConnectionConfig.DuplicateCredentials(replicaKey) | ||
| connectionConfig := thlr.controlReplicaConnectionConfig(replicaKey) | ||
|
|
||
| if err := connectionConfig.RegisterTLSConfig(); err != nil { | ||
| return &mysql.ReplicationLagResult{Err: err} | ||
| } | ||
|
danieljoos marked this conversation as resolved.
|
||
|
|
@@ -443,7 +455,9 @@ func (thlr *Throttler) collectGeneralThrottleMetrics() error { | |
| // that may affect throttling. There are several components, all running independently, | ||
| // that collect such metrics. | ||
| func (thlr *Throttler) initiateThrottlerCollection(firstThrottlingCollected chan<- bool) { | ||
| go thlr.collectReplicationLag(firstThrottlingCollected) | ||
| if !thlr.migrationContext.IsMoveTablesMode() { | ||
| go thlr.collectReplicationLag(firstThrottlingCollected) | ||
| } | ||
| go thlr.collectControlReplicasLag() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to gate this one behind move tables mode? Quick glance at the code of
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
sorry misread your question. I'll look into that. |
||
| go thlr.collectThrottleHTTPStatus(firstThrottlingCollected) | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.