Skip to content

Commit

Permalink
bugfix: cant serialize by jackson (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
576470954 authored Oct 14, 2023
1 parent 7d0617c commit 4330268
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/client/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestLoadPath(t *testing.T) {

assert.NotNil(t, cfg.ClientConfig.UndoConfig)
assert.Equal(t, true, cfg.ClientConfig.UndoConfig.DataValidation)
assert.Equal(t, "jackson", cfg.ClientConfig.UndoConfig.LogSerialization)
assert.Equal(t, "json", cfg.ClientConfig.UndoConfig.LogSerialization)
assert.Equal(t, "undo_log", cfg.ClientConfig.UndoConfig.LogTable)
assert.Equal(t, true, cfg.ClientConfig.UndoConfig.OnlyCareUpdateColumns)
assert.NotNil(t, cfg.ClientConfig.UndoConfig.CompressConfig)
Expand Down
4 changes: 2 additions & 2 deletions pkg/datasource/sql/undo/base/undo.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func (m *BaseUndoLogManager) FlushUndoLog(tranCtx *types.TransactionContext, con
}

parseContext := make(map[string]string, 0)
parseContext[serializerKey] = "jackson"
parseContext[serializerKey] = "json"
// Todo use config
parseContext[compressorTypeKey] = compressor.CompressorNone.String()
undoLogContent := m.encodeUndoLogCtx(parseContext)
Expand Down Expand Up @@ -378,7 +378,7 @@ func (m *BaseUndoLogManager) Undo(ctx context.Context, dbType types.DBType, xid
func (m *BaseUndoLogManager) insertUndoLogWithGlobalFinished(ctx context.Context, xid string, branchID uint64, conn *sql.Conn) error {
// todo use config to replace
parseContext := make(map[string]string, 0)
parseContext[serializerKey] = "jackson"
parseContext[serializerKey] = "json"
parseContext[compressorTypeKey] = compressor.CompressorNone.String()
undoLogContent := m.encodeUndoLogCtx(parseContext)

Expand Down
2 changes: 1 addition & 1 deletion pkg/datasource/sql/undo/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type Config struct {

func (u *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) {
f.BoolVar(&u.DataValidation, prefix+".data-validation", true, "Judge whether the before image and after image are the same,If it is the same, undo will not be recorded")
f.StringVar(&u.LogSerialization, prefix+".log-serialization", "jackson", "Serialization method.")
f.StringVar(&u.LogSerialization, prefix+".log-serialization", "json", "Serialization method.")
f.StringVar(&u.LogTable, prefix+".log-table", "undo_log", "undo log table name.")
f.BoolVar(&u.OnlyCareUpdateColumns, prefix+".only-care-update-columns", true, "The switch for degrade check.")
u.CompressConfig.RegisterFlagsWithPrefix(prefix+".compress", f)
Expand Down
2 changes: 1 addition & 1 deletion testdata/conf/seatago.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ seata:
# Judge whether the before image and after image are the same,If it is the same, undo will not be recorded
data-validation: true
# Serialization method
log-serialization: jackson
log-serialization: json
# undo log table name
log-table: undo_log
# Only store modified fields
Expand Down

0 comments on commit 4330268

Please sign in to comment.