diff --git a/pkg/binlog/event/util.go b/pkg/binlog/event/util.go index c8ac8d1230..c02b34dcaa 100644 --- a/pkg/binlog/event/util.go +++ b/pkg/binlog/event/util.go @@ -459,6 +459,7 @@ func statusVarsToKV(statusVars []byte) (map[byte][]byte, error) { } buf = append(buf, b) } + b = byte(1) // reset to any non-zero value } value = append(value, buf...) default: diff --git a/pkg/binlog/event/util_test.go b/pkg/binlog/event/util_test.go index a67e454d60..d536224ce7 100644 --- a/pkg/binlog/event/util_test.go +++ b/pkg/binlog/event/util_test.go @@ -90,6 +90,18 @@ func (t *testUtilSuite) TestStatusVarsToKV(c *C) { }, nil, }, + { + []byte{0, 0, 0, 0, 0, 1, 0, 0, 32, 80, 0, 0, 0, 0, 6, 3, 115, 116, 100, 4, 33, 0, 33, 0, 33, 0, 11, 4, 114, 111, 111, 116, 9, 108, 111, 99, 97, 108, 104, 111, 115, 116, 12, 2, 109, 121, 115, 113, 108, 0, 97, 117, 116, 104, 111, 114, 105, 122, 101, 0}, + map[byte][]byte{ + 0: {0, 0, 0, 0}, + 1: {0, 0, 32, 80, 0, 0, 0, 0}, + 6: {3, 115, 116, 100}, + 4: {33, 0, 33, 0, 33, 0}, + 11: {4, 114, 111, 111, 116, 9, 108, 111, 99, 97, 108, 104, 111, 115, 116}, + 12: {2, 109, 121, 115, 113, 108, 0, 97, 117, 116, 104, 111, 114, 105, 122, 101, 0}, + }, + nil, + }, } for _, t := range testCases {