Skip to content

Commit

Permalink
test: fix canal_json_storage test (#1014)
Browse files Browse the repository at this point in the history
ref #442
  • Loading branch information
wk989898 authored Feb 18, 2025
1 parent 6cd203d commit e4f3520
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions pkg/sink/codec/canal/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,14 +601,17 @@ type JSONTxnEventEncoder struct {
txnCommitTs uint64
txnSchema *string
txnTable *string

columnSelector columnselector.Selector
}

// NewJSONTxnEventEncoderBuilder creates a new JSONTxnEventEncoder
func NewJSONTxnEventEncoderBuilder(config *common.Config) common.TxnEventEncoder {
return &JSONTxnEventEncoder{
valueBuf: &bytes.Buffer{},
terminator: []byte(config.Terminator),
config: config,
valueBuf: &bytes.Buffer{},
terminator: []byte(config.Terminator),
columnSelector: columnselector.NewDefaultColumnSelector(),
config: config,
}
}

Expand All @@ -620,9 +623,10 @@ func (j *JSONTxnEventEncoder) AppendTxnEvent(event *commonEvent.DMLEvent) error
break
}
value, err := newJSONMessageForDML(&commonEvent.RowEvent{
TableInfo: event.TableInfo,
CommitTs: event.CommitTs,
Event: row,
TableInfo: event.TableInfo,
CommitTs: event.CommitTs,
Event: row,
ColumnSelector: j.columnSelector,
}, j.config, false, "")
if err != nil {
return err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export-fix-sql = true
check-struct-only = false

[task]
output-dir = "/tmp/tidb_cdc_test/partition_table/sync_diff/output"
output-dir = "/tmp/tidb_cdc_test/canal_json_storage_partition_table/sync_diff/output"

source-instances = ["mysql1"]

Expand Down

0 comments on commit e4f3520

Please sign in to comment.