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

Commit

Permalink
cherry pick #1298 to release-2.0 (#1299)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-srebot authored Nov 25, 2020
1 parent 13191a8 commit 26c2078
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/binlog/event/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,11 @@ func statusVarsToKV(statusVars []byte) (map[byte][]byte, error) {
return generateError(err)
}
value = append(value, count)
// if count is 254 (OVER_MAX_DBS_IN_EVENT_MTS), there's no following DB names
// https://github.com/mysql/mysql-server/blob/ee4455a33b10f1b1886044322e4893f587b319ed/libbinlogevents/include/binlog_event.h#L107
if count == 254 {
break
}

buf := make([]byte, 0, 128)
b := byte(1) // initialize to any non-zero value
Expand Down
12 changes: 12 additions & 0 deletions pkg/binlog/event/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ func (t *testUtilSuite) TestStatusVarsToKV(c *C) {
},
nil,
},
// OVER_MAX_DBS_IN_EVENT_MTS in Q_UPDATED_DB_NAMES
{
[]byte{0, 0, 0, 0, 0, 1, 0, 0, 160, 85, 0, 0, 0, 0, 6, 3, 115, 116, 100, 4, 45, 0, 45, 0, 33, 0, 12, 254},
map[byte][]byte{
0: {0, 0, 0, 0},
1: {0, 0, 160, 85, 0, 0, 0, 0},
6: {3, 115, 116, 100},
4: {45, 0, 45, 0, 33, 0},
12: {254},
},
nil,
},
}

for _, t := range testCases {
Expand Down

0 comments on commit 26c2078

Please sign in to comment.