Skip to content

Commit 7dda3e9

Browse files
authored
DM: Support MariaDB Xid binlog status (#12408)
close #12407
1 parent b9d2c6d commit 7dda3e9

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

dm/pkg/binlog/event/util.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ const (
311311
QSqlRequirePrimaryKey
312312
QDefaultTableEncryption
313313
QHrnow = 128
314+
QXid = 129
314315
)
315316

316317
// https://dev.mysql.com/doc/internals/en/query-event.html
@@ -335,6 +336,8 @@ var statusVarsFixedLength = map[byte]int{
335336
QDefaultTableEncryption: 1,
336337
// https://github.com/MariaDB/server/blob/94b45787045677c106a25ebb5aaf1273040b2ff6/sql/log_event.cc#L1619
337338
QHrnow: 3,
339+
// https://mariadb.com/docs/server/reference/clientserver-protocol/replication-protocol/query_event#q_xid-0x81
340+
QXid: 8,
338341
}
339342

340343
// getSQLMode gets SQL mode from binlog statusVars, still could return a reasonable value if found error.

dm/pkg/binlog/event/util_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,17 @@ func TestStatusVarsToKV(t *testing.T) {
124124
},
125125
nil,
126126
},
127+
{ // QXid
128+
[]byte{0, 0, 0, 0, 1, 1, 0, 0, 32, 84, 0, 0, 0, 0, 6, 3, 115, 116, 100, 4, 255, 0, 255, 0, 0, 9, 129, 134, 9, 0, 0, 0, 0, 0, 0},
129+
map[byte][]byte{
130+
0: {0, 0, 0, 1},
131+
1: {0, 0, 32, 84, 0, 0, 0, 0},
132+
4: {255, 0, 255, 0, 0, 9},
133+
6: {3, 115, 116, 100},
134+
129: {134, 9, 0, 0, 0, 0, 0, 0}, // QXid from MariaDB
135+
},
136+
nil,
137+
},
127138
}
128139

129140
for _, test := range testCases {

0 commit comments

Comments
 (0)