Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] tools-v2: add snapshot copyset --all #2618

Merged
merged 1 commit into from
Jul 16, 2023

Conversation

montaguelhz
Copy link
Contributor

@montaguelhz montaguelhz commented Jul 8, 2023

What problem does this PR solve?

Issue Number: #2352

Problem Summary:

What is changed and how it works?

What's Changed:

How it Works:

curve bs snapshot copyset --all

+----------------+---------+
|  CHUNKSERVER   | RESULT  |
+----------------+---------+
| **.*.*.**:8200 | failed  |
+----------------+---------+
| **.*.*.**:8201 | success |
+----------------+         +
| **.*.*.**:8202 |         |
+----------------+---------+

Side effects(Breaking backward compatibility? Performance regression?):

Check List

  • Relevant documentation/comments is changed or added
  • I acknowledge that all my contributions will be made under the project's license

@montaguelhz
Copy link
Contributor Author

cicheck

Copy link
Contributor

@Xinlong-Chen Xinlong-Chen left a comment

Choose a reason for hiding this comment

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

great job~ keep coding~

Copy link
Contributor

@Xinlong-Chen Xinlong-Chen left a comment

Choose a reason for hiding this comment

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

LGTM

@Xinlong-Chen
Copy link
Contributor

@Cyber-SiKu please take a look this pr~

@Xinlong-Chen
Copy link
Contributor

cicheck

@@ -488,6 +488,10 @@ func AddBsAllOptionFlag(cmd *cobra.Command) {
AddBsBoolOptionFlag(cmd, CURVEBS_ALL, "all")
}

func AddBsCopysetIdOptionFlag(cmd *cobra.Command) {
AddBsUint32OptionFlag(cmd, CURVEBS_COPYSET_ID, "copyset id")
Copy link
Contributor

Choose a reason for hiding this comment

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

option flag should be given default value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -56,65 +59,107 @@ func (sRpc *SnapshotRpc) Stub_Func(ctx context.Context) (interface{}, error) {
return sRpc.Client.Snapshot(ctx, sRpc.Request)
}

type SnapshotOneCommand struct {
type SnapshotAllRpc struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can split snapshotAllRpc and snapshotRpc into two commands, and then remove these two commands separately, which will make it clearer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@montaguelhz montaguelhz force-pushed the snapshot branch 4 times, most recently from 31c74bd to dd6b5b0 Compare July 12, 2023 15:49
@montaguelhz
Copy link
Contributor Author

cicheck

@montaguelhz
Copy link
Contributor Author

@Cyber-SiKu a big change waits for your cr.

Copy link
Contributor

@Xinlong-Chen Xinlong-Chen left a comment

Choose a reason for hiding this comment

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

wow~ using sub-command is a good way to let user understand our code!

Xinlong-Chen

This comment was marked as duplicate.

@Xinlong-Chen
Copy link
Contributor

cicheck

retErr.Format(err.Error())
return nil, nil, retErr
}
return sCmd.TableNew, sCmd.Result, cmderror.Success()
Copy link
Contributor

Choose a reason for hiding this comment

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

You can return the response (or a map) directly instead of the table, the table has no information

retErr.Format(err.Error())
return nil, nil, retErr
}
return sCmd.TableNew, sCmd.Result, cmderror.Success()
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

response, err := basecmd.GetRpcResponse(sCmd.Rpc.Info, sCmd.Rpc)
sCmd.Error = err
func (sCmd *SnapshotCopysetCommand) RunCommand(cmd *cobra.Command, args []string) error {
var table, res interface{}
Copy link
Contributor

Choose a reason for hiding this comment

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

Put the processing of the result here

Signed-off-by: montaguelhz <1443171175@qq.com>
@montaguelhz
Copy link
Contributor Author

cicheck

@Cyber-SiKu Cyber-SiKu merged commit c4174c5 into opencurve:master Jul 16, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants