Browse Source

bugfix: cant serialize by jackson (#607)

tags/v2.0.0
576470954 GitHub 1 year ago
parent
commit
4330268686
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions
  1. +1
    -1
      pkg/client/config_test.go
  2. +2
    -2
      pkg/datasource/sql/undo/base/undo.go
  3. +1
    -1
      pkg/datasource/sql/undo/config.go
  4. +1
    -1
      testdata/conf/seatago.yml

+ 1
- 1
pkg/client/config_test.go View File

@@ -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)


+ 2
- 2
pkg/datasource/sql/undo/base/undo.go View File

@@ -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)



+ 1
- 1
pkg/datasource/sql/undo/config.go View File

@@ -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)


+ 1
- 1
testdata/conf/seatago.yml View File

@@ -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


Loading…
Cancel
Save