From 139a71b0fd704e115170d475cc7db92378e8fed5 Mon Sep 17 00:00:00 2001 From: lance6716 Date: Mon, 8 Mar 2021 16:02:05 +0800 Subject: [PATCH] config: disable heartbeat feature (#1467) --- dm/config/task.go | 5 ++++- dm/config/task_test.go | 5 +++++ pkg/v1workermeta/api.go | 2 ++ tests/import_v10x/conf/task.yaml | 2 +- tests/tiup/conf/task.yaml | 1 + 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dm/config/task.go b/dm/config/task.go index c4af372b0d..a033572b05 100644 --- a/dm/config/task.go +++ b/dm/config/task.go @@ -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 diff --git a/dm/config/task_test.go b/dm/config/task_test.go index 76787f774f..67218ecaf1 100644 --- a/dm/config/task_test.go +++ b/dm/config/task_test.go @@ -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()) } diff --git a/pkg/v1workermeta/api.go b/pkg/v1workermeta/api.go index d9026be256..b3e63e5173 100644 --- a/pkg/v1workermeta/api.go +++ b/pkg/v1workermeta/api.go @@ -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 { diff --git a/tests/import_v10x/conf/task.yaml b/tests/import_v10x/conf/task.yaml index 8d85a51204..fddd0483cb 100644 --- a/tests/import_v10x/conf/task.yaml +++ b/tests/import_v10x/conf/task.yaml @@ -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 diff --git a/tests/tiup/conf/task.yaml b/tests/tiup/conf/task.yaml index 39853ffaea..6d2d4e0105 100644 --- a/tests/tiup/conf/task.yaml +++ b/tests/tiup/conf/task.yaml @@ -2,6 +2,7 @@ name: upgrade_via_tiup task-mode: all is-sharding: true +enable-heartbeat: true target-database: host: tidb