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
Added a safety check before add a learner in etcd cluster. #605
Added a safety check before add a learner in etcd cluster. #605
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
Can you please add a test case to test this functionality?
A positive test case is already there, and for -ve tests I can't mock function like |
@@ -252,7 +258,15 @@ func (e *EtcdInitializer) restoreInMultiNode(ctx context.Context) error { | |||
return fmt.Errorf("unable to remove the data-dir %v", err) | |||
} | |||
|
|||
if err := retry.OnError(retry.DefaultBackoff, errors.AnyError, func() error { | |||
if err := retry.OnError(retry.DefaultBackoff, errors.IsErrNotNil, func() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be a code repetition. Can we extract this into a reusable function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Looks good to me. /lgtm
8c5fda0
to
ba2c7c7
Compare
Resolved the merge conflicts. PTAL |
What this PR does / why we need it:
This PR adds a safety check of whether data-dir exist or not before adding new member as a learner(non-voting member) in etcd cluster.
Which issue(s) this PR fixes:
Fixes #576
Special notes for your reviewer:
Release note: