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

config: disable heartbeat feature #1467

Merged
merged 6 commits into from
Mar 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about set it false explicitly.

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