Skip to content

Commit

Permalink
dm: support MySQL 8.0 GA (#10415)
Browse files Browse the repository at this point in the history
close #10405
  • Loading branch information
lyzx2001 authored Jan 5, 2024
1 parent d060a7d commit d412672
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions dm/pkg/checker/mysql_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ func NewMySQLVersionChecker(db *sql.DB, dbinfo *dbutil.DBConfig) RealChecker {
}

// SupportedVersion defines the MySQL/MariaDB version that DM/syncer supports
// * 5.6.0 <= MySQL Version < 8.0.0.
// * 5.6.0 <= MySQL Version < 8.1.0.
var SupportedVersion = map[string]struct {
Min MySQLVersion
Max MySQLVersion
}{
"mysql": {
MySQLVersion{5, 6, 0},
MySQLVersion{8, 0, 0},
MySQLVersion{8, 1, 0},
},
}

Expand Down
8 changes: 5 additions & 3 deletions dm/pkg/checker/mysql_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ func TestMysqlVersion(t *testing.T) {
{"5.6.0-log", true},
{"5.7.0-log", true},
{"5.8.0-log", true}, // although it does not exist
{"8.0.1-log", false},
{"8.0.20", false},
{"8.0.1-log", true},
{"8.0.20", true},
{"8.0.35", true},
{"8.1.0", false},
{"5.5.50-MariaDB-1~wheezy", false},
{"10.1.1-MariaDB-1~wheezy", false},
{"10.1.2-MariaDB-1~wheezy", false},
Expand All @@ -57,7 +59,7 @@ func TestVersionInstruction(t *testing.T) {
db: db,
dbinfo: &dbutil.DBConfig{},
}
mock.ExpectQuery("SHOW GLOBAL VARIABLES LIKE 'version';").WillReturnRows(sqlmock.NewRows([]string{"Variable_name", "Value"}).AddRow("version", "8.0.20"))
mock.ExpectQuery("SHOW GLOBAL VARIABLES LIKE 'version';").WillReturnRows(sqlmock.NewRows([]string{"Variable_name", "Value"}).AddRow("version", "8.1.0"))
result := versionChecker.Check(context.Background())
require.Equal(t, result.State, StateWarning)
require.Equal(t, result.Instruction, "It is recommended that you select a database version that meets the requirements before performing data migration. Otherwise data inconsistency or task exceptions might occur.")
Expand Down
3 changes: 2 additions & 1 deletion dm/pkg/checker/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ func TestVersionComparison(t *testing.T) {
{"5.6.0", true, false, true, true},
{"5.7.0", true, true, true, true},
{"5.8.0", true, true, true, true}, // although it does not exist
{"8.0.1", true, true, false, false},
{"8.0.1", true, true, true, true},
{"8.1.0", true, true, false, true},
{"255.255.255", true, true, false, false}, // max version
}

Expand Down
1 change: 0 additions & 1 deletion dm/tests/dmctl_command/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ function check_task_lightning() {
run_sql_tidb "set @@GLOBAL.max_connections=0;"
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"check-task $cur/conf/dm-task2.yaml" \
"\"passed\": true" 1 \
"task precheck cannot accurately check the number of connection needed for Lightning" 0
run_sql_tidb "set @@GLOBAL.max_connections=5;"
# fail but give warning, because it's using Lightining
Expand Down
2 changes: 1 addition & 1 deletion dm/tests/extend_column/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function run_case() {
"does not exist in downstream table" 2 \
"must contain extended columns" 2 \
'"severity": "fail"' 4 \
'"severity": "warn"' 1
'"severity": "warn"' 0

# create table in tidb
run_sql_file $cur/data/tidb.prepare.sql $TIDB_HOST $TIDB_PORT $TIDB_PASSWORD
Expand Down

0 comments on commit d412672

Please sign in to comment.