Skip to content

Commit dc7d081

Browse files
authored
Merge pull request #688 from yrbb/fix/dumpregexp
fix dump gtid regexp
2 parents 73ce4d0 + 9a02ac1 commit dc7d081

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

dump/parser.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func init() {
3535
// The pattern will only match MySQL GTID, as you know SET GLOBAL gtid_slave_pos='0-1-4' is used for MariaDB.
3636
// SET @@GLOBAL.GTID_PURGED='1638041a-0457-11e9-bb9f-00505690b730:1-429405150';
3737
// 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+)+)`)
38+
gtidExp = regexp.MustCompile(`(\w{8}(-\w{4}){3}-\w{12}(:\d+(-\d+)?)+)`)
3939
}
4040

4141
// Parse the dump data with Dumper generate.

dump/parser_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ e7574090-b123-11e8-8bb4-005056a29643:1-12'
4444
`,
4545
"e50bd2d3-6ad7-11e9-890c-42010af0017c:1-5291126581:5291126583-5323107666",
4646
},
47+
{`SET @@GLOBAL.GTID_PURGED='071a84e8-b253-11e8-8472-005056a27e86:1,
48+
2337be48-0456-11e9-bd1c-00505690543b:1-7,
49+
5f1eea9e-b1e5-11e8-bc77-005056a221ed:1-144609156,
50+
e7574090-b123-11e8-8bb4-005056a29643:1'
51+
`, "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"},
4752
}
4853

4954
for _, tt := range tbls {

dump/setup_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
// use docker mysql for test
1212
var host = flag.String("host", "127.0.0.1", "MySQL host")
13-
var port = flag.Int("port", 3306, "MySQL host")
13+
var port = flag.Int("port", 3306, "MySQL port")
1414

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

0 commit comments

Comments
 (0)