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 bs recover volume #2936

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

CrystalAnalyst
Copy link
Contributor

What problem does this PR solve?

Issue Number: #2588

Problem Summary: add recover as a middle command, and it has sub-command volume.

What is changed and how it works?

What's Changed: add recover middle command directory, and subcommand directory volume.

How it Works: recover.go is the middle command. Inside the sub-direcotry volume , the volume.go is the final command, while the recover.go wraps the RecoverFilePRC to execute the real recover procedure.

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

Check List

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

Copy link
Member

@baytan0720 baytan0720 left a comment

Choose a reason for hiding this comment

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

Rebase commits as one. If you open a new pr, plz close the old one

Copy link
Member

Choose a reason for hiding this comment

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

Is this file unused?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the file is used, which wraps the RecoverFile RPC.

Copy link
Contributor

Choose a reason for hiding this comment

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

One volume.go file is ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One volume.go file is ok.

Actually, my first PR just did so, then I'm told that recover is a middle comamnd, maybe it would recover something else in the future? So I add this mid command. I think it's innocuous.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, The recover is seen as middle command but you can refer the stop snapshot 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.

Yes, The recover is seen as middle command but you can refer the stop snapshot command.

You're right! I finally got what you mean and make correspoding change. Please take a look, thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but it also can be realized using one file and refer to other 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.

Sorry, I don't catch what you mean. I just realize it using one file, Is there something still need to improve?

@baytan0720 baytan0720 requested a review from Cyber-SiKu December 6, 2023 12:25
@baytan0720 baytan0720 changed the title Feat: add curve bs recover volume [feat]tools-v2: add bs recover volume Dec 6, 2023
@CrystalAnalyst CrystalAnalyst force-pushed the feature-recover branch 2 times, most recently from 927d463 to 48b6138 Compare December 6, 2023 15:06
@baytan0720
Copy link
Member

@caoxianfei1 PTAL

Comment on lines 2015 to 2019
+---------+
| RESULT |
+---------+
| success |
+---------+
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we can show path in table.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for suggestion. done.
7GQY~XDDM6P_TJNI3`H C6X

Comment on lines 136 to 142
func NewRecoverFileCommand() *RecoverFileCommand {
RecoverFileCommand := &RecoverFileCommand{
FinalCurveCmd: basecmd.FinalCurveCmd{},
}
basecmd.NewFinalCurveCli(&RecoverFileCommand.FinalCurveCmd, RecoverFileCommand)
return RecoverFileCommand
}
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 func on top.

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.

@CrystalAnalyst CrystalAnalyst force-pushed the feature-recover branch 2 times, most recently from 9ce7daf to 5a4c6bd Compare December 19, 2023 13:32
@CrystalAnalyst CrystalAnalyst force-pushed the feature-recover branch 6 times, most recently from d34076c to 89f1287 Compare December 23, 2023 13:23
@baytan0720
Copy link
Member

cicheck

1 similar comment
@baytan0720
Copy link
Member

cicheck

@caoxianfei1
Copy link
Contributor

caoxianfei1 commented Dec 25, 2023

@CrystalAnalyst need rebase otherwise ci may fail.

@CrystalAnalyst CrystalAnalyst force-pushed the feature-recover branch 2 times, most recently from f95d183 to 7d4dafd Compare December 25, 2023 10:38
@CrystalAnalyst
Copy link
Contributor Author

cicheck

2 similar comments
@CrystalAnalyst
Copy link
Contributor Author

cicheck

@CrystalAnalyst
Copy link
Contributor Author

cicheck

Copy link
Contributor

@caoxianfei1 caoxianfei1 left a comment

Choose a reason for hiding this comment

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

LGTM!

@caoxianfei1
Copy link
Contributor

@CrystalAnalyst please fix the conflict.

Copy link
Contributor

@montaguelhz montaguelhz left a comment

Choose a reason for hiding this comment

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

good job

return recoverCommand.Error.ToError()
}
out := make(map[string]string)
out[cobrautil.ROW_FILE_NAME] = *recoverCommand.Rpc.Request.FileName
Copy link
Contributor

Choose a reason for hiding this comment

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

it might be handled in Init

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


var _ basecmd.FinalCurveCmdFunc = (*RecoverFileCommand)(nil)

func (recoverCommand *RecoverFileCommand) Init(cmd *cobra.Command, args []string) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

why not rCmd

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
Copy link
Contributor

Use rebase instead of merge.

@montaguelhz
Copy link
Contributor

Also, it might be better to leave a blank line between the comment and the code.

@CrystalAnalyst CrystalAnalyst force-pushed the feature-recover branch 3 times, most recently from 4ef46ea to 328d977 Compare December 26, 2023 08:31
@CrystalAnalyst
Copy link
Contributor Author

Also, it might be better to leave a blank line between the comment and the code.

okay.

@CrystalAnalyst
Copy link
Contributor Author

Use rebase instead of merge.

yes, I reset to previous commit and use rebase solved the conflict justnow.

@caoxianfei1
Copy link
Contributor

the commit message suggestion is:
Feat/tool: add command recover volume

@caoxianfei1
Copy link
Contributor

cicheck

Copy link
Member

@baytan0720 baytan0720 left a comment

Choose a reason for hiding this comment

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

LGTM

)

const (
RecoverExample = `curve bs recover volume --path /curvebs-volume-path
Copy link
Contributor

Choose a reason for hiding this comment

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

const (
	RecoverExample = `curve bs recover volume --path /curvebs-volume-path 
--user username [--password password] [--fileid fileid]`
)

Extra Spaces may appear when executing help command.

@CrystalAnalyst
Copy link
Contributor Author

cicheck

@baytan0720
Copy link
Member

cicheck

@caoxianfei1
Copy link
Contributor

LGTM!

Copy link
Contributor

@montaguelhz montaguelhz left a comment

Choose a reason for hiding this comment

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

LGTM

@CrystalAnalyst
Copy link
Contributor Author

cicheck

@CrystalAnalyst
Copy link
Contributor Author

All checks have passed. Is there anyone who is authorized to help me merge this pull request ? @caoxianfei1 @montaguelhz @baytan0720 I'd appreciate that, thanks.

@caoxianfei1 caoxianfei1 merged commit 3a82cb7 into opencurve:master Jan 4, 2024
4 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.

4 participants