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

dmctl: refine commands' usage text #296

Merged
merged 8 commits into from
Sep 25, 2019
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
2 changes: 1 addition & 1 deletion dm/ctl/ctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func Start(args []string) {
}

// --worker worker1 -w worker2 --worker=worker3,worker4 -w=worker5,worker6
rootCmd.PersistentFlags().StringSliceVarP(&commandMasterFlags.workers, "worker", "w", []string{}, "dm-worker ID")
rootCmd.PersistentFlags().StringSliceVarP(&commandMasterFlags.workers, "worker", "w", []string{}, "DM-worker ID")
rootCmd.AddCommand(
master.NewStartTaskCmd(),
master.NewStopTaskCmd(),
Expand Down
4 changes: 2 additions & 2 deletions dm/ctl/master/break_ddl_lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
func NewBreakDDLLockCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "break-ddl-lock <-w worker ...> <task-name> [--remove-id] [--exec] [--skip]",
Short: "force to break dm-worker's DDL lock",
Short: "forcefully break DM-worker's DDL lock",
Run: breakDDLLockFunc,
}
cmd.Flags().StringP("remove-id", "i", "", "DDLLockInfo's ID which need to remove")
Expand All @@ -51,7 +51,7 @@ func breakDDLLockFunc(cmd *cobra.Command, _ []string) {
return
}
if len(workers) == 0 {
fmt.Println("must specify at least one dm-worker (`-w` / `--worker`)")
fmt.Println("must specify at least one DM-worker (`-w` / `--worker`)")
return
}

Expand Down
2 changes: 1 addition & 1 deletion dm/ctl/master/check_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
func NewCheckTaskCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "check-task <config-file>",
Short: "check a task with config file",
Short: "check the config file of the task",
Run: checkTaskFunc,
}
return cmd
Expand Down
2 changes: 1 addition & 1 deletion dm/ctl/master/migrate_relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
func NewMigrateRelayCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "migrate-relay <worker> <binlogName> <binlogPos>",
Short: "migrate dm-worker's relay unit",
Short: "migrate DM-worker's relay unit",
Run: migrateRelayFunc,
}
return cmd
Expand Down
4 changes: 2 additions & 2 deletions dm/ctl/master/pause_relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
func NewPauseRelayCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "pause-relay <-w worker ...>",
Short: "pause dm-worker's relay unit",
Short: "pause DM-worker's relay unit",
Run: pauseRelayFunc,
}
return cmd
Expand All @@ -46,7 +46,7 @@ func pauseRelayFunc(cmd *cobra.Command, _ []string) {
return
}
if len(workers) == 0 {
fmt.Println("must specify at least one dm-worker (`-w` / `--worker`)")
fmt.Println("must specify at least one DM-worker (`-w` / `--worker`)")
return
}

Expand Down
2 changes: 1 addition & 1 deletion dm/ctl/master/pause_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
func NewPauseTaskCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "pause-task [-w worker ...] <task-name>",
Short: "pause a running task with name",
Short: "pause a specified running task",
Run: pauseTaskFunc,
}
return cmd
Expand Down
10 changes: 5 additions & 5 deletions dm/ctl/master/purge_relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ func NewPurgeRelayCmd() *cobra.Command {
//Use: "purge-relay <-w worker> [--inactive] [--time] [--filename] [--sub-dir]",
//Short: "purge dm-worker's relay log files, choose 1 of 2 methods",
Use: "purge-relay <-w worker> [--filename] [--sub-dir]",
Short: "purge dm-worker's relay log files according to specified filename",
Short: "purge relay log files of the DM-worker according to the specified filename",
Run: purgeRelayFunc,
}
//cmd.Flags().BoolP("inactive", "i", false, "whether try to purge all inactive relay log files")
//cmd.Flags().StringP("time", "t", "", fmt.Sprintf("whether try to purge relay log files before this time, the format is \"%s\"(_ between date and time)", timeFormat))
cmd.Flags().StringP("filename", "f", "", "whether try to purge relay log files before this filename, the format is \"mysql-bin.000006\"")
cmd.Flags().StringP("sub-dir", "s", "", "specify relay sub directory for --filename, if not specified, the latest one will be used, the format is \"2ae76434-f79f-11e8-bde2-0242ac130008.000001\"")
cmd.Flags().StringP("filename", "f", "", "name of the terminal file before which to purge relay log files. Sample format: \"mysql-bin.000006\"")
cmd.Flags().StringP("sub-dir", "s", "", "specify relay sub directory for --filename. If not specified, the latest one will be used. Sample format: \"2ae76434-f79f-11e8-bde2-0242ac130008.000001\"")

return cmd
}
Expand All @@ -65,7 +65,7 @@ func purgeRelayFunc(cmd *cobra.Command, _ []string) {
return
}
if len(workers) == 0 {
fmt.Println("must specify at least one dm-worker (`-w` / `--worker`)")
fmt.Println("must specify at least one DM-worker (`-w` / `--worker`)")
return
}

Expand Down Expand Up @@ -121,7 +121,7 @@ func purgeRelayFunc(cmd *cobra.Command, _ []string) {
//}

if len(filename) > 0 && len(workers) > 1 {
fmt.Println("for --filename, can only specify one dm-worker per time")
fmt.Println("for --filename, can only specify one DM-worker per time")
return
}
if len(subDir) > 0 {
Expand Down
2 changes: 1 addition & 1 deletion dm/ctl/master/query_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
func NewQueryErrorCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "query-error [-w worker ...] [task-name]",
Short: "query task's error",
Short: "query task error",
Run: queryErrorFunc,
}
return cmd
Expand Down
2 changes: 1 addition & 1 deletion dm/ctl/master/query_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
func NewQueryStatusCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "query-status [-w worker ...] [task-name]",
Short: "query task's status",
Short: "query task status",
Run: queryStatusFunc,
}
return cmd
Expand Down
4 changes: 2 additions & 2 deletions dm/ctl/master/resume_relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
func NewResumeRelayCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "resume-relay <-w worker ...>",
Short: "resume dm-worker's relay unit",
Short: "resume DM-worker's relay unit",
Run: resumeRelayFunc,
}
return cmd
Expand All @@ -46,7 +46,7 @@ func resumeRelayFunc(cmd *cobra.Command, _ []string) {
return
}
if len(workers) == 0 {
fmt.Println("must specify at least one dm-worker (`-w` / `--worker`)")
fmt.Println("must specify at least one DM-worker (`-w` / `--worker`)")
return
}

Expand Down
2 changes: 1 addition & 1 deletion dm/ctl/master/resume_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
func NewResumeTaskCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "resume-task [-w worker ...] <task-name>",
Short: "resume a paused task with name",
Short: "resume a specified paused task",
Run: resumeTaskFunc,
}
return cmd
Expand Down
2 changes: 1 addition & 1 deletion dm/ctl/master/sql_inject.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
func NewSQLInjectCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "sql-inject <-w worker> <task-name> <sql1;sql2;>",
Short: "sql-inject injects (limited) sqls into syncer as binlog event",
Short: "inject (limited) SQLs into binlog replication unit as binlog events",
Run: sqlInjectFunc,
}
return cmd
Expand Down
2 changes: 1 addition & 1 deletion dm/ctl/master/sql_replace.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
func NewSQLReplaceCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "sql-replace <-w worker> [-b binlog-pos] [-s sql-pattern] [--sharding] <task-name> <sql1;sql2;>",
Short: "sql-replace replaces SQL in specific binlog-pos or sql-pattern matched with other SQLs, each SQL must ends with semicolon;",
Short: "replace SQLs matched by a specific binlog position (binlog-pos) or a SQL pattern (sql-pattern); each SQL must end with a semicolon",
Run: sqlReplaceFunc,
}
cmd.Flags().StringP("binlog-pos", "b", "", "position used to match binlog event if matched the sql-replace operation will be applied. The format like \"mysql-bin|000001.000003:3270\"")
Expand Down
2 changes: 1 addition & 1 deletion dm/ctl/master/sql_skip.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
func NewSQLSkipCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "sql-skip <-w worker> [-b binlog-pos] [-s sql-pattern] [--sharding] <task-name>",
Short: "sql-skip skips binlog event in specific binlog-pos or sql-pattern matched",
Short: "skip the binlog event matched by a specific binlog position (binlog-pos) or a SQL pattern (sql-pattern)",
Run: sqlSkipFunc,
}
cmd.Flags().StringP("binlog-pos", "b", "", "position used to match binlog event if matched the sql-skip operation will be applied. The format like \"mysql-bin|000001.000003:3270\"")
Expand Down
2 changes: 1 addition & 1 deletion dm/ctl/master/start_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
func NewStartTaskCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "start-task [-w worker ...] <config-file>",
Short: "start a task with config file",
Short: "start a task as defined in the config file",
Run: startTaskFunc,
}
return cmd
Expand Down
2 changes: 1 addition & 1 deletion dm/ctl/master/stop_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
func NewStopTaskCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "stop-task [-w worker ...] <task-name>",
Short: "stop a task with name",
Short: "stop a specified task",
Run: stopTaskFunc,
}
return cmd
Expand Down
4 changes: 2 additions & 2 deletions dm/ctl/master/switch_relay_master.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
func NewSwitchRelayMasterCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "switch-relay-master <-w worker ...>",
Short: "switch master server of dm-worker's relay unit",
Short: "switch the master server of the DM-worker's relay unit",
Run: switchRelayMasterFunc,
}
return cmd
Expand All @@ -47,7 +47,7 @@ func switchRelayMasterFunc(cmd *cobra.Command, _ []string) {
return
}
if len(workers) == 0 {
fmt.Println("must specify at least one dm-worker (`-w` / `--worker`)")
fmt.Println("must specify at least one DM-worker (`-w` / `--worker`)")
return
}

Expand Down
4 changes: 2 additions & 2 deletions dm/ctl/master/unlock_ddl_lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import (
func NewUnlockDDLLockCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "unlock-ddl-lock [-w worker ...] <lock-ID>",
Short: "force to unlock DDL lock",
Short: "forcefully unlock DDL lock",
Run: unlockDDLLockFunc,
}
cmd.Flags().StringP("owner", "o", "", "dm-worker to replace the default owner")
cmd.Flags().StringP("owner", "o", "", "DM-worker to replace the default owner")
cmd.Flags().BoolP("force-remove", "f", false, "force to remove DDL lock")
return cmd
}
Expand Down
2 changes: 1 addition & 1 deletion dm/ctl/master/update_masterconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
func NewUpdateMasterConfigCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "update-master-config <config-file>",
Short: "update configure of DM-master",
Short: "update the config of the DM-master",
Run: updateMasterConfigFunc,
}
return cmd
Expand Down
4 changes: 2 additions & 2 deletions dm/ctl/master/update_relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
func NewUpdateRelayCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "update-relay [-w worker ...] <config-file>",
Short: "update dm-worker's relay unit configure",
Short: "update the relay unit config of the DM-worker",
Run: updateRelayFunc,
}
return cmd
Expand All @@ -49,7 +49,7 @@ func updateRelayFunc(cmd *cobra.Command, _ []string) {

workers, _ := common.GetWorkerArgs(cmd)
if len(workers) != 1 {
fmt.Println("must specify one dm-worker (`-w` / `--worker`)")
fmt.Println("must specify one DM-worker (`-w` / `--worker`)")
return
}

Expand Down
2 changes: 1 addition & 1 deletion dm/ctl/master/update_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
func NewUpdateTaskCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "update-task [-w worker ...] <config-file>",
Short: "update a task's config for routes, filters, column-mappings, black-white-list",
Short: "update a task's config for routes, filters, column-mappings, or black-white-list",
Run: updateTaskFunc,
}
return cmd
Expand Down
2 changes: 1 addition & 1 deletion tests/dmctl_advance/check_list/break_ddl_lock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function break_ddl_lock_wrong_arg() {
function break_ddl_lock_without_worker() {
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"break-ddl-lock test" \
"must specify at least one dm-worker (\`-w\` \/ \`--worker\`)" 1
"must specify at least one DM-worker (\`-w\` \/ \`--worker\`)" 1
}

function break_ddl_lock_shoud_specify_at_least_one() {
Expand Down
2 changes: 1 addition & 1 deletion tests/dmctl_advance/check_list/switch_relay_master.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function switch_relay_master_wrong_arg() {
function switch_relay_master_without_worker() {
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"switch-relay-master" \
"must specify at least one dm-worker (\`-w\` \/ \`--worker\`)" 1
"must specify at least one DM-worker (\`-w\` \/ \`--worker\`)" 1
}

function switch_relay_master_while_master_down() {
Expand Down
2 changes: 1 addition & 1 deletion tests/dmctl_basic/check_list/pause_relay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function pause_relay_wrong_arg() {
function pause_relay_wihout_worker() {
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"pause-relay" \
"must specify at least one dm-worker" 1
"must specify at least one DM-worker" 1
}

function pause_relay_while_master_down() {
Expand Down
4 changes: 2 additions & 2 deletions tests/dmctl_basic/check_list/purge_relay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ function purge_relay_wrong_arg() {
function purge_relay_wihout_worker() {
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"purge-relay" \
"must specify at least one dm-worker (\`-w\` \/ \`--worker\`)" 1
"must specify at least one DM-worker (\`-w\` \/ \`--worker\`)" 1
}

function purge_relay_filename_with_multi_workers() {
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"purge-relay --filename bin-000001 -w 127.0.0.1:$WORKER1_PORT -w 127.0.0.1:$WORKER2_PORT" \
"for --filename, can only specify one dm-worker per time" 1
"for --filename, can only specify one DM-worker per time" 1
}

function purge_relay_while_master_down() {
Expand Down
2 changes: 1 addition & 1 deletion tests/dmctl_basic/check_list/resume_relay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function resume_relay_wrong_arg() {
function resume_relay_wihout_worker() {
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"resume-relay" \
"must specify at least one dm-worker" 1
"must specify at least one DM-worker" 1
}

function resume_relay_while_master_down() {
Expand Down
2 changes: 1 addition & 1 deletion tests/dmctl_basic/check_list/update_relay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function update_relay_should_specify_one_dm_worker() {
task_conf=$1
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"update-relay $task_conf" \
"must specify one dm-worker (\`-w\` \/ \`--worker\`)" 1
"must specify one DM-worker (\`-w\` \/ \`--worker\`)" 1
}

function update_relay_while_master_down() {
Expand Down