From 43302686863ad10979e6eb1acf83978717e47473 Mon Sep 17 00:00:00 2001 From: 576470954 <576470954@qq.com> Date: Sat, 14 Oct 2023 20:33:11 +0800 Subject: [PATCH] bugfix: cant serialize by jackson (#607) --- pkg/client/config_test.go | 2 +- pkg/datasource/sql/undo/base/undo.go | 4 ++-- pkg/datasource/sql/undo/config.go | 2 +- testdata/conf/seatago.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/client/config_test.go b/pkg/client/config_test.go index b60ae7889..058bccde4 100644 --- a/pkg/client/config_test.go +++ b/pkg/client/config_test.go @@ -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) diff --git a/pkg/datasource/sql/undo/base/undo.go b/pkg/datasource/sql/undo/base/undo.go index 40e4eb06b..3e5f44991 100644 --- a/pkg/datasource/sql/undo/base/undo.go +++ b/pkg/datasource/sql/undo/base/undo.go @@ -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) @@ -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) diff --git a/pkg/datasource/sql/undo/config.go b/pkg/datasource/sql/undo/config.go index 54101fa25..fb9805609 100644 --- a/pkg/datasource/sql/undo/config.go +++ b/pkg/datasource/sql/undo/config.go @@ -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) diff --git a/testdata/conf/seatago.yml b/testdata/conf/seatago.yml index de09102b5..f5eef5408 100644 --- a/testdata/conf/seatago.yml +++ b/testdata/conf/seatago.yml @@ -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