Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
config: disable heartbeat feature (#1467)
Browse files Browse the repository at this point in the history
  • Loading branch information
lance6716 authored Mar 8, 2021
1 parent 864aaa4 commit 139a71b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
5 changes: 4 additions & 1 deletion dm/config/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,10 @@ func (c *TaskConfig) SubTaskConfigs(sources map[string]DBConfig) ([]*SubTaskConf
cfg.Mode = c.TaskMode
cfg.CaseSensitive = c.CaseSensitive
cfg.MetaSchema = c.MetaSchema
cfg.EnableHeartbeat = c.EnableHeartbeat
cfg.EnableHeartbeat = false
if c.EnableHeartbeat {
log.L().Warn("DM 2.0 does not support heartbeat feature, will overwrite it to false")
}
cfg.HeartbeatUpdateInterval = c.HeartbeatUpdateInterval
cfg.HeartbeatReportInterval = c.HeartbeatReportInterval
cfg.Timezone = c.Timezone
Expand Down
5 changes: 5 additions & 0 deletions dm/config/task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,11 @@ func (t *testConfig) TestGenAndFromSubTaskConfigs(c *C) {
// deprecated config will not recover
stCfgs[0].EnableANSIQuotes = stCfg1.EnableANSIQuotes
stCfgs[1].EnableANSIQuotes = stCfg2.EnableANSIQuotes
// some features are disabled
c.Assert(stCfg1.EnableHeartbeat, IsTrue)
c.Assert(stCfg2.EnableHeartbeat, IsTrue)
stCfg1.EnableHeartbeat = false
stCfg2.EnableHeartbeat = false
c.Assert(stCfgs[0].String(), Equals, stCfg1.String())
c.Assert(stCfgs[1].String(), Equals, stCfg2.String())
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/v1workermeta/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ func SubTaskConfigFromV1TOML(data []byte) (config.SubTaskConfig, error) {
}

cfg := v1Cfg.SubTaskConfig
// DM v2.0 doesn't support heartbeat, overwrite it to false
cfg.EnableHeartbeat = false
cfg.MydumperConfig.ChunkFilesize = strconv.FormatInt(v1Cfg.ChunkFilesize, 10)
err = cfg.Adjust(true)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion tests/import_v10x/conf/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ is-sharding: false
shard-mode: ""
ignore-checking-items: []
meta-schema: dm_meta
enable-heartbeat: true
enable-heartbeat: false
heartbeat-update-interval: 1
heartbeat-report-interval: 1
timezone: Asia/Shanghai
Expand Down
1 change: 1 addition & 0 deletions tests/tiup/conf/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name: upgrade_via_tiup
task-mode: all
is-sharding: true
enable-heartbeat: true

target-database:
host: tidb
Expand Down

0 comments on commit 139a71b

Please sign in to comment.