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

dmctl: fix handle err commands #1746

Merged
merged 35 commits into from
Aug 18, 2021

Conversation

lichunzhu
Copy link
Contributor

@lichunzhu lichunzhu commented Jun 3, 2021

What problem does this PR solve?

#1692 part 1

What is changed and how it works?

Add binlog, shard-ddl-locks, binlog-schema, config commands and update relative integration tests.

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • Has exported function/method change

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

@lichunzhu lichunzhu added the needs-cherry-pick-release-2.0 This PR should be cherry-picked to release-2.0. Remove this label after cherry-picked to release-2.0 label Jun 3, 2021
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jun 3, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • GMHDBJD
  • lance6716

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@lichunzhu lichunzhu marked this pull request as ready for review June 4, 2021 12:16
@lichunzhu lichunzhu added the status/PTAL This PR is ready for review. Add this label back after committing new changes label Jun 4, 2021
Copy link
Contributor

@Ehco1996 Ehco1996 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wiil review later

@lance6716 lance6716 added this to the v2.0.5 milestone Jun 7, 2021
cmd := &cobra.Command{
Use: "task [task-name]",
Short: "manage or show task configs",
RunE: configTaskList,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use anonymous functions in the same format as above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which format?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lance6716 lance6716 removed the status/PTAL This PR is ready for review. Add this label back after committing new changes label Jul 29, 2021
@lance6716 lance6716 added this to the v2.0.6 milestone Jul 30, 2021
@lance6716 lance6716 added the needs-update-docs Should update docs after this PR is merged. Remove this label once the docs are updated label Jul 30, 2021
@lance6716
Copy link
Collaborator

@lichunzhu new comments added, PTAL

Copy link
Collaborator

@glorv glorv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest LGTM

newExportCfgsCmd(),
newImportCfgsCmd(),
)
cmd.PersistentFlags().StringP("path", "d", "", "specify the file path to export`")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cmd.PersistentFlags().StringP("path", "d", "", "specify the file path to export`")
cmd.PersistentFlags().StringP("path", "p", "", "specify the file path to export`")

}

func configMasterList(cmd *cobra.Command, args []string) error {
if len(args) == 0 || len(args) > 1 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if len(args) == 0 || len(args) > 1 {
if len(args) != 1 {

RunE: exportCfgsFunc,
}
cmd.Flags().StringP("dir", "d", "configs", "specify the output directory, default is `./configs`")
cmd.Flags().String("dir", "", "specify the configs directory, default is `./configs`")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove the short parameter -d

return cmd
}

// exportCfgsFunc exports configs.
func exportCfgsFunc(cmd *cobra.Command, args []string) error {
dir, err := cmd.Flags().GetString("dir")
filePath, err := cmd.Flags().GetString("path")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused by this path parameter. It seems like a single file path, but actually it means the path to a directory. Then why we need to support both path and dir while there is no difference

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We used to support dir parameter. To keep compatible with older version we support both now but mark dir as hidden.

)

// NewShardDDLLockCmd creates a ShardDDLLock command.
func NewShardDDLLockCmd() *cobra.Command {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we can merge shard-ddl-lock and show-ddl-lock into one command

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any suggestion?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe shard-ddl-lock show?

@lance6716
Copy link
Collaborator

@lichunzhu new comments added, PTAL

@GMHDBJD GMHDBJD modified the milestones: v2.0.6, v2.1.0 Aug 13, 2021
@lichunzhu
Copy link
Contributor Author

@GMHDBJD @glorv PTAL again

Copy link
Collaborator

@GMHDBJD GMHDBJD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-chi-bot ti-chi-bot added status/LGT2 Two reviewers already commented LGTM, ready for merge and removed status/LGT1 One reviewer already commented LGTM labels Aug 16, 2021
@Ehco1996
Copy link
Contributor

@lichunzhu please merge master and resolve conflits

@lance6716
Copy link
Collaborator

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 72226d1

@ti-chi-bot ti-chi-bot merged commit a9bd623 into pingcap:master Aug 18, 2021
ti-chi-bot pushed a commit to ti-chi-bot/dm that referenced this pull request Aug 18, 2021
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #2011.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-cherry-pick-release-2.0 This PR should be cherry-picked to release-2.0. Remove this label after cherry-picked to release-2.0 needs-update-docs Should update docs after this PR is merged. Remove this label once the docs are updated needs-update-release-note This PR should be added into release notes. Remove this label once the release notes are updated size/XXL status/can-merge status/LGT2 Two reviewers already commented LGTM, ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants