-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Fix issue with tablet_template_url in HealthCheck #3959
Fix issue with tablet_template_url in HealthCheck #3959
Conversation
* Without this change, loadTabletUrl is only called during init method and it won't have the flag parsed yet. Signed-off-by: Rafael Chacon <[email protected]>
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.
Makes sense :)
LGTM after my comment is addressed.
go/vt/discovery/healthcheck.go
Outdated
@@ -120,12 +120,11 @@ const ( | |||
) | |||
|
|||
func init() { | |||
loadTabletURLTemplate() | |||
LoadHealthCheckTabletURLTemplate() |
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 should be removed then?
Instead, add a comment to the function "LoadHealthCheckTabletURLTemplate" that it should only be called after the flags are parsed?
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.
I left it intentionally because there was one template test that was failing without it. Fixing the test is straightforward, but I was worried that there might be a case out in the while where the template is used before LoadHealthCheckTabletURLTemplate
is called. To be safe, I decided to leave the init.
Are you confident that is safe to remove?
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.
Okay, scratch what I said earlier. I understand the problem now.
I suggest the following:
- Rename the method to
ParseTabletURLTemplateFromFlag
. - Add here a comment: "Flags are not parsed at this point and the default value of the flag (just the hostname) will be used."
- And a comment in the other file: "Flags are parsed now. Parse the template using the actual flag value and overwrite the current template."
What do you think?
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.
I think that makes. It will be clearer this way.
Signed-off-by: Rafael Chacon <[email protected]>
…emove more errors from operator planning (vitessio#3959) Signed-off-by: Andres Taylor <[email protected]>
Description
init()
is called.Tests