Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Undo config #410

Merged
merged 35 commits into from
Jan 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
10fba9a
doc: v1.0.2-RC1 release file (#338)
raspberry-hu Nov 23, 2022
2983fad
doc: v1.0.2-RC1 release file (#338)
jasondeng1997 Nov 25, 2022
29591b3
Merge remote-tracking branch 'origin/master'
jasondeng1997 Nov 25, 2022
6e0ac7a
Merge remote-tracking branch 'origin/master'
jasondeng1997 Nov 25, 2022
e93ce2f
Merge remote-tracking branch 'origin/master'
jasondeng1997 Nov 25, 2022
a2ffd6a
Merge remote-tracking branch 'origin/master'
jasondeng1997 Nov 25, 2022
c990bbd
Merge remote-tracking branch 'origin/master'
jasondeng1997 Nov 25, 2022
e3380e5
Merge remote-tracking branch 'origin/master'
jasondeng1997 Nov 25, 2022
9d7e7d0
Merge remote-tracking branch 'origin/master'
jasondeng1997 Dec 4, 2022
6e0c1ad
Merge remote-tracking branch 'origin/master'
jasondeng1997 Dec 4, 2022
0bff304
Merge remote-tracking branch 'origin/master'
jasondeng1997 Dec 4, 2022
d1376f6
Merge remote-tracking branch 'origin/master'
jasondeng1997 Dec 4, 2022
f85166b
Merge remote-tracking branch 'origin/master'
jasondeng1997 Dec 4, 2022
1f19eed
Merge remote-tracking branch 'origin/master'
jasondeng1997 Dec 4, 2022
81f6d39
Merge remote-tracking branch 'origin/master'
jasondeng1997 Dec 6, 2022
bd4eebe
Merge remote-tracking branch 'origin/master'
jasondeng1997 Dec 6, 2022
9f2a4f9
Merge remote-tracking branch 'origin/master'
jasondeng1997 Dec 7, 2022
f2005e6
Merge branch 'seata:master' into master
jasondeng1997 Dec 7, 2022
98e4ffc
Merge branch 'seata:master' into master
jasondeng1997 Dec 9, 2022
4604d46
Merge branch 'seata:master' into master
jasondeng1997 Dec 11, 2022
be73193
Merge branch 'seata:master' into master
jasondeng1997 Dec 11, 2022
4580f3f
Merge remote-tracking branch 'origin/master'
jasondeng1997 Dec 12, 2022
c2e8fed
Merge remote-tracking branch 'origin/master'
jasondeng1997 Dec 12, 2022
dddefdb
Merge remote-tracking branch 'origin/master'
jasondeng1997 Dec 16, 2022
1b18b1b
Merge remote-tracking branch 'origin/master'
jasondeng1997 Dec 16, 2022
21f8a6e
Merge remote-tracking branch 'origin/master'
jasondeng1997 Dec 16, 2022
938f560
Merge remote-tracking branch 'origin/master'
jasondeng1997 Dec 16, 2022
f50bfa0
Merge remote-tracking branch 'origin/master'
jasondeng1997 Dec 16, 2022
9a76349
feat:提交说明
jasondeng1997 Dec 21, 2022
3f7dacb
feat:提交说明
jasondeng1997 Dec 21, 2022
bf8e154
Merge remote-tracking branch 'origin/undo' into undo
jasondeng1997 Dec 21, 2022
beb89bf
Merge remote-tracking branch 'origin/undo' into undo
jasondeng1997 Dec 21, 2022
f35bc90
Merge remote-tracking branch 'origin/undo' into undo
jasondeng1997 Dec 22, 2022
6c962c3
Merge remote-tracking branch 'origin/undo' into undo
jasondeng1997 Dec 22, 2022
a9e7bff
Merge remote-tracking branch 'origin/undo' into undo
jasondeng1997 Jan 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions pkg/datasource/sql/undo/undo_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package undo

import (
"flag"
)

type CompressConfig struct {
Enable bool `yaml:"enable" json:"enable,omitempty" `
Type string `yaml:"type" json:"type,omitempty" `
Threshold int `yaml:"threshold" json:"threshold,omitempty" `
}

type UndoConfig struct {
DataValidation bool `yaml:"data-validation" json:"data-validation,omitempty" `
LogSerialization string `yaml:"log-serialization" json:"log-serialization,omitempty" `
LogTable string `yaml:"log-table" json:"log-table,omitempty" `
OnlyCareUpdateColumns bool `yaml:"only-care-update-columns" json:"only-care-update-columns,omitempty" `
Compress CompressConfig `yaml:"compress" json:"compress,omitempty" `
}

func (ufg *UndoConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) {
f.BoolVar(&ufg.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(&ufg.LogSerialization, prefix+".log-serialization", "jackson", "Serialization method.")
f.StringVar(&ufg.LogTable, prefix+".log-table", "undo_log", "undo log table name.")
f.BoolVar(&ufg.OnlyCareUpdateColumns, prefix+".only-care-update-columns", true, "The switch for degrade check.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里要调用下 Compress.RegisterFlagsWithPrefix


}

// RegisterFlagsWithPrefix for Compress.
func (cfg *CompressConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) {
f.BoolVar(&cfg.Enable, prefix+".log-table-name", true, "Whether compression is required.")
f.StringVar(&cfg.Type, prefix+".clean-period", "zip", "Compression type")
f.IntVar(&cfg.Threshold, prefix+".clean-period", 64, "Compression threshold Unit: k")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在client.Config加上,还有单测

}
54 changes: 54 additions & 0 deletions pkg/datasource/sql/undo/undo_config_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package undo

import (
"flag"
"testing"
)

func TestCompressConfig_RegisterFlagsWithPrefix(t *testing.T) {
type fields struct {
Enable bool
Type string
Threshold int
}
type args struct {
prefix string
f *flag.FlagSet
}
tests := []struct {
name string
fields fields
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
})
}
}

func TestUndoConfig_RegisterFlagsWithPrefix(t *testing.T) {
type fields struct {
DataValidation bool
LogSerialization string
LogTable string
OnlyCareUpdateColumns bool
Compress CompressConfig
}
type args struct {
prefix string
f *flag.FlagSet
}
tests := []struct {
name string
fields fields
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
})
}
}