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

*: warn the deprecated remove-meta in task config (#964) #965

Merged
merged 3 commits into from
Aug 31, 2020
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
7 changes: 7 additions & 0 deletions dm/config/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down
3 changes: 3 additions & 0 deletions dm/master/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion syncer/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
1 change: 1 addition & 0 deletions tests/dmctl_command/conf/dm-task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion tests/dmctl_command/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/import_v10x/conf/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,4 @@ syncers:
enable-ansi-quotes: false
clean-dump-file: false
ansi-quotes: false
remove-meta: false