Skip to content

Commit

Permalink
Partial support for 8.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
morgo committed May 20, 2024
1 parent 886ee21 commit 38af78b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ For replica throttling, Spirit requires:
GRANT SELECT on performance_schema.replication_applier_status_by_worker TO 'throttler';
```

(i.e. Replica throttling does not use `SHOW SLAVE STATUS`.)
(i.e. Replica throttling does not use `SHOW REPLICA STATUS`.)

## Risks and Limitations

Expand Down
6 changes: 3 additions & 3 deletions pkg/check/replicahealth.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ func init() {
registerCheck("replicahealth", replicaHealth, ScopePostSetup|ScopeCutover)
}

// replicaHealth checks SHOW SLAVE STATUS for Yes and Yes.
// replicaHealth checks SHOW REPLICA STATUS for Yes and Yes.
// It should be run at various stages of the migration if a replica is present.
func replicaHealth(ctx context.Context, r Resources, logger loggers.Advanced) error {
if r.Replica == nil {
return nil // The user is not using the replica DSN feature.
}
rows, err := r.Replica.Query("SHOW SLAVE STATUS") //nolint: execinquery
rows, err := r.Replica.Query("SHOW REPLICA STATUS") //nolint: execinquery
if err != nil {
return err
}
Expand All @@ -27,7 +27,7 @@ func replicaHealth(ctx context.Context, r Resources, logger loggers.Advanced) er
if err != nil {
return err
}
if status["Slave_IO_Running"].String != "Yes" || status["Slave_SQL_Running"].String != "Yes" {
if status["Replica_IO_Running"].String != "Yes" || status["Replica_SQL_Running"].String != "Yes" {
return errors.New("replica is not healthy")
}
return nil
Expand Down
7 changes: 1 addition & 6 deletions pkg/check/replicaprivileges.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ func init() {
}

// Check that there is permission to run perfschema queries for replication (8.0)
// or SHOW SLAVE STATUS (5.7).
func replicaPrivilegeCheck(ctx context.Context, r Resources, logger loggers.Advanced) error {
if r.Replica == nil {
return nil // The user is not using the replica DSN feature.
Expand All @@ -21,11 +20,7 @@ func replicaPrivilegeCheck(ctx context.Context, r Resources, logger loggers.Adva
if err := r.Replica.QueryRow("select substr(version(), 1, 1)").Scan(&version); err != nil {
return err // can not get version
}
lagQuery := `SHOW SLAVE STATUS`
if version == "8" {
lagQuery = throttler.MySQL8LagQuery
}
rows, err := r.Replica.Query(lagQuery) //nolint: execinquery
rows, err := r.Replica.Query(throttler.MySQL8LagQuery) //nolint: execinquery

Check failure on line 23 in pkg/check/replicaprivileges.go

View workflow job for this annotation

GitHub Actions / lint

directive `//nolint: execinquery` is unused for linter "execinquery" (nolintlint)
if err != nil {
return err
}
Expand Down

0 comments on commit 38af78b

Please sign in to comment.