Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandr Shevchuk committed Sep 12, 2023
1 parent c36b6d0 commit 6643c6a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1783,16 +1783,16 @@ func (app *App) repairCascadeNode(node *mysql.Node, clusterState map[string]*Nod

func (app *App) repairExternalReplication(masterNode *mysql.Node) {
extReplStatus, err := masterNode.GetExternalReplicaStatus()
if extReplStatus == nil {
// external replication is not supported
return
}
if err != nil {
if !mysql.IsErrorChannelDoesNotExists(err) {
app.logger.Errorf("repair (external): host %s failed to get external replica status %v", masterNode.Host(), err)
}
return
}
if extReplStatus == nil {
// external replication is not supported
return
}

if extReplStatus.ReplicationState() == mysql.ReplicationError {
// TODO: remove "". Master is not needed for external replication now
Expand Down
7 changes: 4 additions & 3 deletions internal/app/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func StartSlaveAlgorithm(app *App, node *mysql.Node, _ string, channel string) e

func ResetSlaveAlgorithm(app *App, node *mysql.Node, master string, channel string) error {
// TODO we don't want reset slave on external replication
// May be we should split algorithms by channel type (ext/int)
if channel == app.config.ExternalReplicationChannel {
app.logger.Infof("external repair: don't want to use ResetSlaveAlgorithm, leaving")
return nil
Expand Down Expand Up @@ -137,13 +138,13 @@ func (state *ReplicationRepairState) cooldownPassed(replicationRepairCooldown ti
return state.LastAttempt.Before(cooldown)
}

func (app *App) getOrCreateHostRepairState(host string) *ReplicationRepairState {
func (app *App) getOrCreateHostRepairState(stateKey string) *ReplicationRepairState {
var replState *ReplicationRepairState
if state, ok := app.replRepairState[host]; ok {
if state, ok := app.replRepairState[stateKey]; ok {
replState = state
} else {
replState = app.createRepairState()
app.replRepairState[host] = replState
app.replRepairState[stateKey] = replState
}

return replState
Expand Down
2 changes: 1 addition & 1 deletion internal/mysql/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ func (n *Node) GetExternalReplicaStatus() (ReplicaStatus, error) {
func (n *Node) ReplicaStatusWithTimeout(timeout time.Duration, channel string) (ReplicaStatus, error) {
query, status, err := n.GetVersionSlaveStatusQuery()
if err != nil {
return nil, nil
return nil, err
}
err = n.queryRowMogrifyWithTimeout(query, map[string]interface{}{
"channel": channel,
Expand Down

0 comments on commit 6643c6a

Please sign in to comment.