Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

dumpling: support metadata without GTID (#1122) #1123

Merged
merged 1 commit into from
Sep 30, 2020
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
4 changes: 4 additions & 0 deletions pkg/dumpling/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ func ParseMetaData(filename, flavor string) (*binlog.Location, *binlog.Location,
if err2 != nil {
return err2
}
line = strings.TrimSpace(line)
if len(line) == 0 {
return nil
}
parts := strings.SplitN(line, ":", 2)
if len(parts) != 2 {
continue
Expand Down
24 changes: 24 additions & 0 deletions pkg/dumpling/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,30 @@ Finished dump at: 2020-05-21 18:14:49`,
},
"5b5a8e4e-9b43-11ea-900d-0242ac170002:1-10,5b642cb6-9b43-11ea-8914-0242ac170003:1-9,97b5142f-e19c-11e8-808c-0242ac110005:1-13",
},
{ // no GTID sets
`Started dump at: 2020-09-30 12:16:49
SHOW MASTER STATUS:
Log: mysql-bin-changelog.000003
Pos: 12470000

SHOW MASTER STATUS: /* AFTER CONNECTION POOL ESTABLISHED */
Log: mysql-bin-changelog.000003
Pos: 12470000

Finished dump at: 2020-09-30 12:16:49
`,
mysql.Position{
Name: "mysql-bin-changelog.000003",
Pos: 12470000,
},
"",
true,
mysql.Position{
Name: "mysql-bin-changelog.000003",
Pos: 12470000,
},
"",
},
}

for _, tc := range testCases {
Expand Down