Skip to content
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

DM: Support MySQL 8.4 #11020

Open
dveeden opened this issue May 2, 2024 · 6 comments
Open

DM: Support MySQL 8.4 #11020

dveeden opened this issue May 2, 2024 · 6 comments
Labels
area/dm Issues or PRs related to DM. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. type/feature Issues about a new feature

Comments

@dveeden
Copy link
Contributor

dveeden commented May 2, 2024

Is your feature request related to a problem?

MySQL 8.4 removes things like SHOW MASTER STATUS. These have been replaced with SHOW BINARY LOG STATUS.

So things like this needs an update:

rows, err := db.QueryContext(ctx, `SHOW MASTER STATUS`)

rows, err := db.QueryContext(ctx, `SHOW SLAVE HOSTS`)

This should be done without breaking compatibility with MySQL 8.0, 5.7 or MariaDB

This depends on:

Describe the feature you'd like

.

Describe alternatives you've considered

No response

Teachability, Documentation, Adoption, Migration Strategy

No response

@dveeden dveeden added the type/feature Issues about a new feature label May 2, 2024
@dveeden
Copy link
Contributor Author

dveeden commented May 2, 2024

/area dm
/label compatibility

Copy link
Contributor

ti-chi-bot bot commented May 2, 2024

@dveeden: The label(s) compatibility cannot be applied. These labels are supported: duplicate, bug-from-internal-test, bug-from-user, ok-to-test, needs-ok-to-test, affects-5.4, affects-6.1, affects-6.5, affects-7.1, affects-7.5, affects-8.1, may-affects-5.4, may-affects-6.1, may-affects-6.5, may-affects-7.1, may-affects-7.5, may-affects-8.1, needs-cherry-pick-release-5.4, needs-cherry-pick-release-6.1, needs-cherry-pick-release-6.5, needs-cherry-pick-release-7.1, needs-cherry-pick-release-7.5, needs-cherry-pick-release-8.1, question, release-blocker, wontfix, MariaDB.

In response to this:

/area dm
/label compatibility

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot bot added the area/dm Issues or PRs related to DM. label May 2, 2024
@dveeden
Copy link
Contributor Author

dveeden commented May 2, 2024

cc @lance6716

@lance6716
Copy link
Contributor

/assign @lyzx2001

@dveeden
Copy link
Contributor Author

dveeden commented May 7, 2024

Related: go-mysql-org/go-mysql#866

@dveeden
Copy link
Contributor Author

dveeden commented Oct 24, 2024

Maybe something like this:

diff --git a/dm/pkg/conn/utils.go b/dm/pkg/conn/utils.go
index df18fe876..3bef16ec0 100644
--- a/dm/pkg/conn/utils.go
+++ b/dm/pkg/conn/utils.go
@@ -15,6 +15,7 @@ package conn
 
 import (
        "context"
+       "database/sql"
        "fmt"
        "math"
        "strconv"
@@ -107,9 +108,15 @@ func GetMasterStatus(ctx *tcontext.Context, db *BaseDB, flavor string) (
                binlogIgnoreDB string
                gtidStr        string
                err            error
+               rows           *sql.Rows
        )
        // need REPLICATION SLAVE privilege
-       rows, err := db.QueryContext(ctx, `SHOW MASTER STATUS`)
+       rows, err = db.QueryContext(ctx, `SHOW BINARY LOG STATUS`)
+       if err != nil {
+               if strings.Contains(err.Error(), "You have an error in your SQL syntax") {
+                       rows, err = db.QueryContext(ctx, `SHOW MASTER STATUS`)
+               }
+       }
        if err != nil {
                err = terror.DBErrorAdapt(err, db.Scope, terror.ErrDBDriverError)
                return binlogName, pos, binlogDoDB, binlogIgnoreDB, gtidStr, err

While there is the notion of a flavor, there isn't really a good/easy way go get the version (e.g. from the "ServerGreeting)" without executing another query. Maybe we should do a SELECT VERSION() once after the connection is established and then store it so we can do if flavor==MySQL && version.Compare(...) {}

@lance6716 lance6716 added the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dm Issues or PRs related to DM. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. type/feature Issues about a new feature
Projects
None yet
Development

No branches or pull requests

3 participants