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

Check PD enpoints status when it's unhealthy. #545

Merged
merged 5 commits into from
Jun 10, 2019

Conversation

tkanng
Copy link
Contributor

@tkanng tkanng commented Jun 2, 2019

What problem does this PR solve?

This PR check PD endpoints status when PD is unhealthy, according to #293.

What is changed and how it works?

  • Add endpointsLister to pdMemberManager
  • Chage the order pdClient.GetHealth() and pdClient.GetCluster()

Check List

Tests

  • Unit test [Done]
  • E2E test: Something went wrong when I try to do E2E test. e2e test failure

Code changes

  • Has Go code change

Related changes

Does this PR introduce a user-facing change?:

NONE

@sre-bot
Copy link
Contributor

sre-bot commented Jun 2, 2019

Hi contributor, thanks for your PR.

This patch needs to be approved by someone of admins. They should reply with "/ok-to-test" to accept this PR for running test automatically.

@CLAassistant
Copy link

CLAassistant commented Jun 2, 2019

CLA assistant check
All committers have signed the CLA.

@weekface
Copy link
Contributor

weekface commented Jun 3, 2019

/run-e2e-tests

Copy link
Contributor

@weekface weekface left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution.

@@ -40,6 +40,7 @@ type pdMemberManager struct {
setLister v1beta1.StatefulSetLister
svcLister corelisters.ServiceLister
podLister corelisters.PodLister
epsLister corelisters.EndpointsLister
Copy link
Contributor

Choose a reason for hiding this comment

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

use gofmt to format the source code.

@weekface weekface requested review from aylei and gregwebs and removed request for aylei June 3, 2019 03:17
@weekface
Copy link
Contributor

weekface commented Jun 3, 2019

@gregwebs PTAL

@tkanng
Copy link
Contributor Author

tkanng commented Jun 3, 2019

@weekface

  • Use gofmt to format the code, or the make check will be filled.

Hi, the code has been formatted in the latest commit, and passed make check after I remove megacheck tool. And there is something wrong when I execute make check command. Detail: #546

New issue: #547

@weekface
Copy link
Contributor

weekface commented Jun 3, 2019

Yes, megacheck has been removed, this is a fix pr: #548

@weekface
Copy link
Contributor

weekface commented Jun 3, 2019

/run-e2e-tests

@tkanng
Copy link
Contributor Author

tkanng commented Jun 3, 2019

Hi, the latest commit adds some unit test about endpoints. However, I'm not sure it's good enough, so please help check it again. Thanks!

@@ -258,18 +261,27 @@ func (pmm *pdMemberManager) syncTidbClusterStatus(tc *v1alpha1.TidbCluster, set

pdClient := pmm.pdControl.GetPDClient(tc)

cluster, err := pdClient.GetCluster()
healthInfo, err := pdClient.GetHealth()
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you chage the order pdClient.GetHealth() and pdClient.GetCluster()?

If there is no special need, it is better to stay in the old order.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It maybe more intuitive to check pd's health first, in my opinion. QAQ

Alright, I'll reset the order.

@weekface
Copy link
Contributor

weekface commented Jun 4, 2019

@xiaojingchen @aylei ptal

@@ -268,6 +271,15 @@ func (pmm *pdMemberManager) syncTidbClusterStatus(tc *v1alpha1.TidbCluster, set
healthInfo, err := pdClient.GetHealth()
if err != nil {
tc.Status.PD.Synced = false
// get endpoints info
Copy link
Contributor

@weekface weekface Jun 4, 2019

Choose a reason for hiding this comment

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

GetCluster() will be failed if there are no endpoints.

so we should move these codes to https://github.com/pingcap/tidb-operator/pull/545/files#diff-006f391cd7cdae269e89bd77e21c1a6fR266

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, I think that it may be better to check health state at first, and check endpoints' status when it's unhealthy, just like the previous code. Here is what I think:

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, i am fine with both orders. But these codes must be moved to the first method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your patience!

Copy link
Contributor

@weekface weekface left a comment

Choose a reason for hiding this comment

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

Rest LGTM

@weekface
Copy link
Contributor

weekface commented Jun 4, 2019

/run-e2e-tests

Copy link
Member

@tennix tennix left a comment

Choose a reason for hiding this comment

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

LGTM

@weekface
Copy link
Contributor

weekface commented Jun 5, 2019

/run-e2e-tests

1 similar comment
@weekface
Copy link
Contributor

weekface commented Jun 5, 2019

/run-e2e-tests

@weekface
Copy link
Contributor

/run-e2e-tests

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.

5 participants