Skip to content

fix dump gtid regexp #688

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

Merged
merged 1 commit into from
Apr 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dump/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func init() {
// The pattern will only match MySQL GTID, as you know SET GLOBAL gtid_slave_pos='0-1-4' is used for MariaDB.
// SET @@GLOBAL.GTID_PURGED='1638041a-0457-11e9-bb9f-00505690b730:1-429405150';
// https://dev.mysql.com/doc/refman/5.7/en/replication-gtids-concepts.html
gtidExp = regexp.MustCompile(`(\w{8}(-\w{4}){3}-\w{12}(:\d+-\d+)+)`)
gtidExp = regexp.MustCompile(`(\w{8}(-\w{4}){3}-\w{12}(:\d+(-\d+)?)+)`)
}

// Parse the dump data with Dumper generate.
Expand Down
5 changes: 5 additions & 0 deletions dump/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ e7574090-b123-11e8-8bb4-005056a29643:1-12'
`,
"e50bd2d3-6ad7-11e9-890c-42010af0017c:1-5291126581:5291126583-5323107666",
},
{`SET @@GLOBAL.GTID_PURGED='071a84e8-b253-11e8-8472-005056a27e86:1,
2337be48-0456-11e9-bd1c-00505690543b:1-7,
5f1eea9e-b1e5-11e8-bc77-005056a221ed:1-144609156,
e7574090-b123-11e8-8bb4-005056a29643:1'
`, "071a84e8-b253-11e8-8472-005056a27e86:1,2337be48-0456-11e9-bd1c-00505690543b:1-7,5f1eea9e-b1e5-11e8-bc77-005056a221ed:1-144609156,e7574090-b123-11e8-8bb4-005056a29643:1"},
}

for _, tt := range tbls {
Expand Down
2 changes: 1 addition & 1 deletion dump/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

// use docker mysql for test
var host = flag.String("host", "127.0.0.1", "MySQL host")
var port = flag.Int("port", 3306, "MySQL host")
var port = flag.Int("port", 3306, "MySQL port")

var execution = flag.String("exec", "mysqldump", "mysqldump execution path")

Expand Down