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

Commit

Permalink
Merge branch 'master' into show-unsynced
Browse files Browse the repository at this point in the history
  • Loading branch information
lance6716 authored Apr 27, 2021
2 parents 87eceda + 4ca895a commit 102c131
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
7 changes: 7 additions & 0 deletions cmd/dm-ctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ func main() {
}
os.Exit(0)
default:
// NOTE: when `--help` in cmdArgs we need to print out the help msg.
for _, cmd := range cmdArgs {
if cmd == "--help" {
ctl.PrintHelp(cmdArgs)
os.Exit(0)
}
}
common.PrintLinesf("parse cmd flags err: %s", terror.Message(err))
os.Exit(2)
}
Expand Down
4 changes: 2 additions & 2 deletions dm/ctl/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func NewConfig() *Config {

fs.BoolVar(&cfg.printVersion, "V", false, "Prints version and exit.")
fs.StringVar(&cfg.ConfigFile, "config", "", "Path to config file.")
fs.StringVar(&cfg.MasterAddr, "master-addr", "", "Master API server address.")
fs.StringVar(&cfg.MasterAddr, "master-addr", "", "Master API server address, this parameter is required when interacting with the dm-master")
fs.StringVar(&cfg.RPCTimeoutStr, "rpc-timeout", defaultRPCTimeout, fmt.Sprintf("RPC timeout, default is %s.", defaultRPCTimeout))
fs.StringVar(&cfg.encrypt, EncryptCmdName, "", "Encrypts plaintext to ciphertext.")
fs.StringVar(&cfg.SSLCA, "ssl-ca", "", "Path of file that contains list of trusted SSL CAs for connection.")
Expand Down Expand Up @@ -150,7 +150,7 @@ func (c *Config) Parse(arguments []string) (finish bool, err error) {
}

if c.MasterAddr == "" {
return false, errors.Errorf("--master-addr not provided, use --help to see help messages")
return false, errors.Errorf("--master-addr not provided, use `dmtcl --help` to see help messages")
}

return false, errors.Trace(c.adjust())
Expand Down
2 changes: 1 addition & 1 deletion dm/master/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func ReportDDLPending(task, oldStatus, newStatus string) {
}
}

// RemoveDDLPending removes all counter of this task
// RemoveDDLPending removes all counter of this task.
func RemoveDDLPending(task string) {
ddlPendingCounter.DeleteAllAboutLabels(prometheus.Labels{"task": task})
}
Expand Down
4 changes: 2 additions & 2 deletions dm/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ func (w *Worker) OperateSubTask(name string, op pb.TaskOp) error {
return err
}

// QueryStatus query worker's sub tasks' status. If relay enabled, also return source status
// QueryStatus query worker's sub tasks' status. If relay enabled, also return source status.
func (w *Worker) QueryStatus(ctx context.Context, name string) ([]*pb.SubTaskStatus, *pb.RelayStatus, error) {
w.RLock()
defer w.RUnlock()
Expand Down Expand Up @@ -524,7 +524,7 @@ func (w *Worker) QueryStatus(ctx context.Context, name string) ([]*pb.SubTaskSta
return subtaskStatus, relayStatus, nil
}

// postProcessStatus fills the status of sync unit with master binlog location and other related fields
// postProcessStatus fills the status of sync unit with master binlog location and other related fields.
func (w *Worker) postProcessStatus(
subtaskStatus []*pb.SubTaskStatus,
masterBinlogPos string,
Expand Down
11 changes: 11 additions & 0 deletions tests/dmctl_command/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ function run() {
exit 1
fi


# check dmctl command start-task --help
# it should print the usage for start-task
$PWD/bin/dmctl.test DEVEL start-task --help > $WORK_DIR/help.log
help_msg=$(cat $WORK_DIR/help.log)
help_msg_cnt=$(echo "${help_msg}" | grep "Usage:" | wc -l)
if [ "$help_msg_cnt" -ne 1 ]; then
echo "dmctl case 4 help failed: $help_msg"
exit 1
fi

# run normal task with command
run_sql_file $cur/data/db1.prepare.sql $MYSQL_HOST1 $MYSQL_PORT1 $MYSQL_PASSWORD1
check_contains 'Query OK, 2 rows affected'
Expand Down

0 comments on commit 102c131

Please sign in to comment.