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

Issue 3452 #3500

Merged
merged 6 commits into from
Sep 27, 2017
Merged

Issue 3452 #3500

merged 6 commits into from
Sep 27, 2017

Conversation

preetapan
Copy link
Contributor

@preetapan preetapan commented Sep 26, 2017

Fixes #3452.

@preetapan
Copy link
Contributor Author

Still needs unit test

Copy link
Contributor

@slackpad slackpad left a comment

Choose a reason for hiding this comment

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

Noted some small stuff and then this should be good to merge.

for _, service := range services.Services {
if service.ID == structs.ConsulServiceID {
serverPort = service.Port
_, node, err := state.GetNode(check.Node)
if err != nil {
s.logger.Printf("[ERR] Unable to look up node with name %v, got error:%v", check.Node, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be [ERR] consul: for the prefix, and we usually just do a colon before the error, so [ERR] consul: Unable to look up node with name %q: %v"

for _, service := range services.Services {
if service.ID == structs.ConsulServiceID {
serverPort = service.Port
_, node, err := state.GetNode(check.Node)
if err != nil {
s.logger.Printf("[ERR] Unable to look up node with name %v, got error:%v", check.Node, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

If we can't get an address we should probably just bail rather than let the net.ParseIP return something bogus below. I'd add a label and do a continue CHECKS here for the error.

joinLAN(t, s1, s2)
joinLAN(t, s1, s3)

state := s1.fsm.State()
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd move this down before the first retry.Run just since it seems out of place here.

Status: api.HealthCritical,
})

// call reconcileReaped with a map that does not contain s2
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment should say s3.

}
})

// Make a failed healthcheck for s2
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need this health check to be registered.

// Should be deregistered; we have to poll quickly here because
// anti-entropy will put it back.
reaped := false
for start := time.Now(); time.Since(start) < 5*time.Second; {
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be a little flaky, but since AE is fairly slow this should be ok. I'd use retry.Run here though and have it fail with an error if the node is still registered, that'll simplify the test.

Copy link
Contributor

@slackpad slackpad left a comment

Choose a reason for hiding this comment

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

LGTM!

for _, service := range services.Services {
if service.ID == structs.ConsulServiceID {
_, node, err := state.GetNode(check.Node)
if err != nil {
s.logger.Printf("[ERR] consul: Unable to look up node with name %q:%v", check.Node, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd add a space after the ":"

if err != nil {
s.logger.Printf("[ERR] consul: Unable to look up node with name %q:%v", check.Node, err)
continue checks
} else {
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 drop the else :-)

@slackpad slackpad merged commit 4d9fc63 into master Sep 27, 2017
@slackpad slackpad deleted the issue_3452 branch September 27, 2017 03:49
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