Skip to content

Commit f5315d9

Browse files
authored
Merge pull request #561 from go-mysql-org/dobegor_patch-1
Fix parsing GTIDs from mysqlpdump
2 parents 8d7152e + 9dcf4c8 commit f5315d9

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

dump/dump_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ e7574090-b123-11e8-8bb4-005056a29643:1-12'
174174
{`SET @@GLOBAL.GTID_PURGED='c0977f88-3104-11e9-81e1-00505690245b:1-274559';
175175
`, "c0977f88-3104-11e9-81e1-00505690245b:1-274559"},
176176
{`CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.008995', MASTER_LOG_POS=102052485;`, ""},
177+
{
178+
`SET @@GLOBAL.GTID_PURGED='e50bd2d3-6ad7-11e9-890c-42010af0017c:1-5291126581:5291126583-5323107666';
179+
`,
180+
"e50bd2d3-6ad7-11e9-890c-42010af0017c:1-5291126581:5291126583-5323107666",
181+
},
177182
}
178183

179184
for _, tt := range tbls {

dump/parser.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ func init() {
3333
useExp = regexp.MustCompile("^USE `(.+)`;")
3434
valuesExp = regexp.MustCompile("^INSERT INTO `(.+?)` VALUES \\((.+)\\);$")
3535
// The pattern will only match MySQL GTID, as you know SET GLOBAL gtid_slave_pos='0-1-4' is used for MariaDB.
36-
//SET @@GLOBAL.GTID_PURGED='1638041a-0457-11e9-bb9f-00505690b730:1-429405150';
37-
gtidExp = regexp.MustCompile("(\\w{8}(-\\w{4}){3}-\\w{12}:\\d+-\\d+)")
36+
// SET @@GLOBAL.GTID_PURGED='1638041a-0457-11e9-bb9f-00505690b730:1-429405150';
37+
// https://dev.mysql.com/doc/refman/5.7/en/replication-gtids-concepts.html
38+
gtidExp = regexp.MustCompile(`(\w{8}(-\w{4}){3}-\w{12}(:\d+-\d+)+)`)
3839
}
3940

4041
// Parse the dump data with Dumper generate.

0 commit comments

Comments
 (0)