Skip to content

Commit 7a98826

Browse files
author
ffffwh
committed
handle MySQL server UUID with trailing zeros #1034
1 parent 0c0c5e0 commit 7a98826

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

driver/mysql/binlog/binlog_reader.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,14 +1259,11 @@ func (b *BinlogReader) skipRowEvent(rowsEvent *replication.RowsEvent, dml int8)
12591259
b.logger.Error("cycle-prevention: unrecognized gtid_executed table sid or gno type",
12601260
"type", hclog.Fmt("%T %T", sidValue, gnoI))
12611261
} else {
1262-
sid, err := uuid.FromBytes([]byte(sidByte))
1263-
if err != nil {
1264-
b.logger.Error("cycle-prevention: cannot convert sid to uuid", "err", err, "sid", sidByte)
1265-
} else {
1266-
coordinate := b.entryContext.Entry.Coordinates.(*common.MySQLCoordinateTx)
1267-
coordinate.SID = sid
1268-
coordinate.GNO = gno
1269-
}
1262+
var sid uuid.UUID // will be initialized to 0
1263+
copy(sid[:], sidByte) // len(sidByte) might be less than 16 #1034
1264+
coordinate := b.entryContext.Entry.Coordinates.(*common.MySQLCoordinateTx)
1265+
coordinate.SID = sid
1266+
coordinate.GNO = gno
12701267
}
12711268
}
12721269
// If OSID is target mysql SID, skip applying the binlogEntry.

0 commit comments

Comments
 (0)