File tree 2 files changed +21
-7
lines changed
2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -451,6 +451,19 @@ func (c *Canal) prepareSyncer() error {
451
451
Logger : c .cfg .Logger ,
452
452
Dialer : c .cfg .Dialer ,
453
453
Localhost : c .cfg .Localhost ,
454
+ RowsEventDecodeFunc : func (event * replication.RowsEvent , data []byte ) error {
455
+ pos , err := event .DecodeHeader (data )
456
+ if err != nil {
457
+ return err
458
+ }
459
+
460
+ key := fmt .Sprintf ("%s.%s" , string (event .Table .Schema ), string (event .Table .Table ))
461
+ if ! c .checkTableMatch (key ) {
462
+ return nil
463
+ }
464
+
465
+ return event .DecodeData (pos , data )
466
+ },
454
467
}
455
468
456
469
if strings .Contains (c .cfg .Addr , "/" ) {
Original file line number Diff line number Diff line change @@ -1018,6 +1018,14 @@ func (e *RowsEvent) decodeExtraData(data []byte) (err2 error) {
1018
1018
}
1019
1019
1020
1020
func (e * RowsEvent ) DecodeData (pos int , data []byte ) (err2 error ) {
1021
+ if e .compressed {
1022
+ data , err2 = DecompressMariadbData (data [pos :])
1023
+ if err2 != nil {
1024
+ //nolint:nakedret
1025
+ return
1026
+ }
1027
+ }
1028
+
1021
1029
// Rows_log_event::print_verbose()
1022
1030
1023
1031
var (
@@ -1073,13 +1081,6 @@ func (e *RowsEvent) Decode(data []byte) error {
1073
1081
if err != nil {
1074
1082
return err
1075
1083
}
1076
- if e .compressed {
1077
- uncompressedData , err := DecompressMariadbData (data [pos :])
1078
- if err != nil {
1079
- return err
1080
- }
1081
- return e .DecodeData (0 , uncompressedData )
1082
- }
1083
1084
return e .DecodeData (pos , data )
1084
1085
}
1085
1086
You can’t perform that action at this time.
0 commit comments