File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -463,7 +463,12 @@ func (c *Canal) prepareSyncer() error {
463463 Dialer : c .cfg .Dialer ,
464464 Localhost : c .cfg .Localhost ,
465465 EventCacheCount : c .cfg .EventCacheCount ,
466- RowsEventDecodeFunc : func (event * replication.RowsEvent , data []byte ) error {
466+ }
467+
468+ if c .cfg .RowsEventDecodeFunc != nil {
469+ cfg .RowsEventDecodeFunc = c .cfg .RowsEventDecodeFunc
470+ } else {
471+ cfg .RowsEventDecodeFunc = func (event * replication.RowsEvent , data []byte ) error {
467472 pos , err := event .DecodeHeader (data )
468473 if err != nil {
469474 return err
@@ -475,7 +480,7 @@ func (c *Canal) prepareSyncer() error {
475480 }
476481
477482 return event .DecodeData (pos , data )
478- },
483+ }
479484 }
480485
481486 if strings .Contains (c .cfg .Addr , "/" ) {
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import (
1414
1515 "github.com/go-mysql-org/go-mysql/client"
1616 "github.com/go-mysql-org/go-mysql/mysql"
17+ "github.com/go-mysql-org/go-mysql/replication"
1718)
1819
1920type DumpConfig struct {
@@ -71,6 +72,9 @@ type Config struct {
7172 IncludeTableRegex []string `toml:"include_table_regex"`
7273 ExcludeTableRegex []string `toml:"exclude_table_regex"`
7374
75+ // Allows to specify a custom function to decode RowsEvent. This can be used to skip decoding of some events.
76+ RowsEventDecodeFunc func (* replication.RowsEvent , []byte ) error
77+
7478 // discard row event without table meta
7579 DiscardNoMetaRowEvent bool `toml:"discard_no_meta_row_event"`
7680
You can’t perform that action at this time.
0 commit comments