@@ -15,6 +15,7 @@ import (
1515 chproto "github.com/ClickHouse/ch-go/proto"
1616 "github.com/ClickHouse/clickhouse-go/v2"
1717 "github.com/go-mysql-org/go-mysql/mysql"
18+ "github.com/go-mysql-org/go-mysql/replication"
1819 "github.com/jackc/pgerrcode"
1920 "github.com/jackc/pgx/v5"
2021 "github.com/jackc/pgx/v5/pgconn"
@@ -907,6 +908,18 @@ func TestMySQLBinlogEventExceededMaxAllowedPacket(t *testing.T) {
907908 }, errInfo , "Unexpected error info" )
908909}
909910
911+ func TestMySQLBinlogChecksumMismatch (t * testing.T ) {
912+ // go-mysql flattens ErrChecksumMismatch into the message; PullRecords wraps it as a MySQLExecuteError.
913+ err := exceptions .NewMySQLExecuteError (
914+ fmt .Errorf ("failed checksum for WriteRowsEventV2, log pos 12345: %v" , replication .ErrChecksumMismatch ))
915+ errorClass , errInfo := GetErrorClass (t .Context (), fmt .Errorf ("failed in pull records: %w" , err ))
916+ assert .Equal (t , ErrorNotifyBinlogInvalid , errorClass , "Unexpected error class" )
917+ assert .Equal (t , ErrorInfo {
918+ Source : ErrorSourceMySQL ,
919+ Code : "BINLOG_CHECKSUM_MISMATCH" ,
920+ }, errInfo , "Unexpected error info" )
921+ }
922+
910923func TestMySQLExecuteError (t * testing.T ) {
911924 err := exceptions .NewMySQLExecuteError (
912925 tls.RecordHeaderError {Msg : "first record does not look like a TLS handshake" })
0 commit comments