diff --git a/dm/config/task.go b/dm/config/task.go index c0a0e51639..bd2eedc4b8 100644 --- a/dm/config/task.go +++ b/dm/config/task.go @@ -309,6 +309,9 @@ type TaskConfig struct { CleanDumpFile bool `yaml:"clean-dump-file" toml:"clean-dump-file" json:"clean-dump-file"` EnableANSIQuotes bool `yaml:"ansi-quotes" toml:"ansi-quotes" json:"ansi-quotes"` + + // deprecated, replaced by `start-task --remove-meta` + RemoveMeta bool `yaml:"remove-meta"` } // NewTaskConfig creates a TaskConfig @@ -537,6 +540,10 @@ func (c *TaskConfig) adjust() error { } } + if c.RemoveMeta { + log.L().Warn("`remove-meta` in task config is deprecated, please use `start-task ... --remove-meta` instead") + } + return nil } diff --git a/dm/master/server.go b/dm/master/server.go index fab9b2fede..99ef3b1ad5 100644 --- a/dm/master/server.go +++ b/dm/master/server.go @@ -482,6 +482,9 @@ func (s *Server) StartTask(ctx context.Context, req *pb.StartTaskRequest) (*pb.S } resp.Result = true + if cfg.RemoveMeta { + resp.Msg = "`remove-meta` in task config is deprecated, please use `start-task ... --remove-meta` instead" + } sourceResps = s.getSourceRespsAfterOperation(ctx, cfg.Name, sources, []string{}, req) } diff --git a/syncer/checkpoint.go b/syncer/checkpoint.go index bc8de2b775..6a4eb9d89e 100644 --- a/syncer/checkpoint.go +++ b/syncer/checkpoint.go @@ -32,11 +32,11 @@ import ( "github.com/pingcap/dm/pkg/schema" "github.com/pingcap/dm/pkg/terror" "github.com/pingcap/dm/pkg/utils" - "github.com/pingcap/tidb-tools/pkg/dbutil" "github.com/pingcap/failpoint" "github.com/pingcap/parser/model" tmysql "github.com/pingcap/parser/mysql" + "github.com/pingcap/tidb-tools/pkg/dbutil" "github.com/siddontang/go-mysql/mysql" "go.uber.org/zap" ) diff --git a/tests/dmctl_command/conf/dm-task.yaml b/tests/dmctl_command/conf/dm-task.yaml index 3ebea97659..4c5473c5f5 100644 --- a/tests/dmctl_command/conf/dm-task.yaml +++ b/tests/dmctl_command/conf/dm-task.yaml @@ -7,6 +7,7 @@ meta-schema: "dm_meta" heartbeat-update-interval: 1 heartbeat-report-interval: 1 timezone: "Asia/Shanghai" +remove-meta: true target-database: host: "127.0.0.1" diff --git a/tests/dmctl_command/run.sh b/tests/dmctl_command/run.sh index c1771b322c..236e70e3b3 100644 --- a/tests/dmctl_command/run.sh +++ b/tests/dmctl_command/run.sh @@ -98,7 +98,10 @@ function run() { dmctl_operate_source create $WORK_DIR/source2.yaml $SOURCE_ID2 # start DM task with command mode - $PWD/bin/dmctl.test DEVEL --master-addr=:$MASTER_PORT start-task $cur/conf/dm-task.yaml + run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \ + "start-task $cur/conf/dm-task.yaml" \ + "\`remove-meta\` in task config is deprecated, please use \`start-task ... --remove-meta\` instead" 1 + check_log_contains $WORK_DIR/master/log/dm-master.log "\`remove-meta\` in task config is deprecated, please use \`start-task ... --remove-meta\` instead" # use sync_diff_inspector to check full dump loader check_sync_diff $WORK_DIR $cur/conf/diff_config.toml diff --git a/tests/import_v10x/conf/task.yaml b/tests/import_v10x/conf/task.yaml index 53fd5c30e7..db0e5464c1 100644 --- a/tests/import_v10x/conf/task.yaml +++ b/tests/import_v10x/conf/task.yaml @@ -124,3 +124,4 @@ syncers: enable-ansi-quotes: false clean-dump-file: false ansi-quotes: false +remove-meta: false