diff --git a/pkg/dumpling/utils.go b/pkg/dumpling/utils.go index 0879dc3aaa..b01c36d766 100644 --- a/pkg/dumpling/utils.go +++ b/pkg/dumpling/utils.go @@ -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 diff --git a/pkg/dumpling/utils_test.go b/pkg/dumpling/utils_test.go index 245f96266f..6c9d9defa2 100644 --- a/pkg/dumpling/utils_test.go +++ b/pkg/dumpling/utils_test.go @@ -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 {