diff --git a/cdc/model/changefeed_test.go b/cdc/model/changefeed_test.go index c23b9b9609d..db137be82af 100644 --- a/cdc/model/changefeed_test.go +++ b/cdc/model/changefeed_test.go @@ -149,8 +149,8 @@ func TestFillV1(t *testing.T) { }, Sink: &config.SinkConfig{ DispatchRules: []*config.DispatchRule{ - {Matcher: []string{"test.tbl3"}, PartitionRule: "ts"}, - {Matcher: []string{"test.tbl4"}, PartitionRule: "rowid"}, + {Matcher: []string{"test.tbl3"}, DispatcherRule: "ts"}, + {Matcher: []string{"test.tbl4"}, DispatcherRule: "rowid"}, }, }, Cyclic: &config.CyclicConfig{ diff --git a/cdc/sink/mysql/txn_cache.go b/cdc/sink/mysql/txn_cache.go index 8fa1a2227b6..e084decaf12 100644 --- a/cdc/sink/mysql/txn_cache.go +++ b/cdc/sink/mysql/txn_cache.go @@ -121,7 +121,9 @@ func (c *unresolvedTxnCache) Resolved( func splitResolvedTxn( resolvedTsMap *sync.Map, unresolvedTxns map[model.TableID][]*txnsWithTheSameCommitTs, -) (checkpointTsMap map[model.TableID]uint64, resolvedRowsMap map[model.TableID][]*model.SingleTableTxn) { +) (checkpointTsMap map[model.TableID]uint64, + resolvedRowsMap map[model.TableID][]*model.SingleTableTxn, +) { var ( ok bool txnsLength int diff --git a/docs/swagger/docs.go b/docs/swagger/docs.go index b62428fb2f4..b097e17f6f7 100644 --- a/docs/swagger/docs.go +++ b/docs/swagger/docs.go @@ -723,6 +723,7 @@ var doc = `{ "type": "object", "properties": { "dispatcher": { + "description": "Deprecated, please use PartitionRule.", "type": "string" }, "matcher": { @@ -731,6 +732,10 @@ var doc = `{ "type": "string" } }, + "partition": { + "description": "PartitionRule is an alias added for DispatcherRule to mitigate confusions.\nIn the future release, the DispatcherRule is expected to be removed .", + "type": "string" + }, "topic": { "type": "string" } diff --git a/docs/swagger/swagger.json b/docs/swagger/swagger.json index 3d6a3e3ab25..9f50eb12882 100644 --- a/docs/swagger/swagger.json +++ b/docs/swagger/swagger.json @@ -704,6 +704,7 @@ "type": "object", "properties": { "dispatcher": { + "description": "Deprecated, please use PartitionRule.", "type": "string" }, "matcher": { @@ -712,6 +713,10 @@ "type": "string" } }, + "partition": { + "description": "PartitionRule is an alias added for DispatcherRule to mitigate confusions.\nIn the future release, the DispatcherRule is expected to be removed .", + "type": "string" + }, "topic": { "type": "string" } diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index e9f59cebcbe..1d0ac4b317b 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -13,11 +13,17 @@ definitions: config.DispatchRule: properties: dispatcher: + description: Deprecated, please use PartitionRule. type: string matcher: items: type: string type: array + partition: + description: |- + PartitionRule is an alias added for DispatcherRule to mitigate confusions. + In the future release, the DispatcherRule is expected to be removed . + type: string topic: type: string type: object diff --git a/pkg/cmd/util/changefeed.toml b/pkg/cmd/util/changefeed.toml index 9c305a4bd35..41202b58e04 100644 --- a/pkg/cmd/util/changefeed.toml +++ b/pkg/cmd/util/changefeed.toml @@ -27,7 +27,7 @@ worker-num = 16 # For MQ Sinks, you can configure event distribution rules through dispatchers # Dispatchers support default, ts, rowid and table dispatchers = [ - { matcher = ['test1.*', 'test2.*'], dispatcher = "ts", topic = "hello_{schema}" }, + { matcher = ['test1.*', 'test2.*'], partition = "ts", topic = "hello_{schema}" }, { matcher = ['test3.*', 'test4.*'], dispatcher = "rowid", topic = "{schema}_world" }, ] # 对于 MQ 类的 Sink,可以通过 column-selectors 配置 column 选择器 diff --git a/pkg/cmd/util/helper_test.go b/pkg/cmd/util/helper_test.go index f0f1d2571f1..61ae730d1cb 100644 --- a/pkg/cmd/util/helper_test.go +++ b/pkg/cmd/util/helper_test.go @@ -16,24 +16,17 @@ package util import ( "bytes" "fmt" + "io/ioutil" "os" "path/filepath" "testing" - "github.com/pingcap/check" "github.com/pingcap/tiflow/pkg/config" - "github.com/pingcap/tiflow/pkg/util/testleak" "github.com/spf13/cobra" + "github.com/stretchr/testify/require" ) -func TestSuite(t *testing.T) { check.TestingT(t) } - -type utilsSuite struct{} - -var _ = check.Suite(&utilsSuite{}) - -func (s *utilsSuite) TestProxyFields(c *check.C) { - defer testleak.AfterTest(c)() +func TestProxyFields(t *testing.T) { revIndex := map[string]int{ "http_proxy": 0, "https_proxy": 1, @@ -46,65 +39,74 @@ func (s *utilsSuite) TestProxyFields(c *check.C) { // Each bit of the mask decided whether this index of `envs` would be set. for mask := 0; mask <= 0b111; mask++ { for _, env := range envs { - c.Assert(os.Unsetenv(env), check.IsNil) + require.Nil(t, os.Unsetenv(env)) } for i := 0; i < 3; i++ { if (1<