Skip to content

Commit

Permalink
cli(ticdc): cli support mounter worker-num parameter (#7681)
Browse files Browse the repository at this point in the history
close #7680
  • Loading branch information
sdojjy authored Nov 22, 2022
1 parent 719d270 commit 822a79f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cdc/api/v2/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ type ReplicaConfig struct {
SyncPointInterval time.Duration `json:"sync_point_interval"`
SyncPointRetention time.Duration `json:"sync_point_retention"`
Filter *FilterConfig `json:"filter"`
Mounter *MounterConfig `json:"mounter"`
Sink *SinkConfig `json:"sink"`
Consistent *ConsistentConfig `json:"consistent"`
}
Expand Down Expand Up @@ -200,6 +201,11 @@ func (c *ReplicaConfig) ToInternalReplicaConfig() *config.ReplicaConfig {
EnablePartitionSeparator: c.Sink.EnablePartitionSeparator,
}
}
if c.Mounter != nil {
res.Mounter = &config.MounterConfig{
WorkerNum: c.Mounter.WorkerNum,
}
}
return res
}

Expand Down Expand Up @@ -305,6 +311,11 @@ func ToAPIReplicaConfig(c *config.ReplicaConfig) *ReplicaConfig {
Storage: cloned.Consistent.Storage,
}
}
if cloned.Mounter != nil {
res.Mounter = &MounterConfig{
WorkerNum: cloned.Mounter.WorkerNum,
}
}
return res
}

Expand Down Expand Up @@ -339,6 +350,11 @@ type FilterConfig struct {
EventFilters []EventFilterRule `json:"event_filters"`
}

// MounterConfig represents mounter config for a changefeed
type MounterConfig struct {
WorkerNum int `json:"worker_num"`
}

// EventFilterRule is used by sql event filter and expression filter
type EventFilterRule struct {
Matcher []string `json:"matcher"`
Expand Down
1 change: 1 addition & 0 deletions cdc/api/v2/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func TestToAPIReplicaConfig(t *testing.T) {
IgnoreDeleteValueExpr: "age > 20",
}},
}
cfg.Mounter = &config.MounterConfig{WorkerNum: 11}
cfg2 := ToAPIReplicaConfig(cfg).ToInternalReplicaConfig()
require.Equal(t, "", cfg2.Sink.DispatchRules[0].DispatcherRule)
cfg.Sink.DispatchRules[0].DispatcherRule = ""
Expand Down

0 comments on commit 822a79f

Please sign in to comment.