Skip to content

Fix issue with tablet_template_url in HealthCheck#3959

Merged
michael-berlin merged 2 commits intovitessio:masterfrom
tinyspeck:fix-healthcheck-tablet-template
May 22, 2018
Merged

Fix issue with tablet_template_url in HealthCheck#3959
michael-berlin merged 2 commits intovitessio:masterfrom
tinyspeck:fix-healthcheck-tablet-template

Conversation

@rafael
Copy link
Copy Markdown
Member

@rafael rafael commented May 22, 2018

Description

Tests

  • Tested locally.

* Without this change, loadTabletUrl is only called during init method and it
won't have the flag parsed yet.

Signed-off-by: Rafael Chacon <rafael@slack-corp.com>
@rafael rafael requested review from demmer and michael-berlin May 22, 2018 03:26
Copy link
Copy Markdown
Contributor

@michael-berlin michael-berlin left a 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.


func init() {
loadTabletURLTemplate()
LoadHealthCheckTabletURLTemplate()
Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Member Author

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?

Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Member Author

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 <rafael@slack-corp.com>
@michael-berlin michael-berlin merged commit d3ec17c into vitessio:master May 22, 2018
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.

2 participants