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

router, backend: check target health before redirection #412

Merged
merged 2 commits into from
Dec 15, 2023

Conversation

djshow832
Copy link
Collaborator

@djshow832 djshow832 commented Dec 14, 2023

What problem does this PR solve?

Issue Number: close #408

Problem Summary:

  • When the connection begins redirection, the target backend may become unhealthy. This will introduce unnecessary errors.
  • In ensureBackend, the newly added backend may be removed by adjustBackendList.

What is changed and how it works:

  • Pass BackendInst interface (instead of addr) to the BackendConnMgr in Redirect()
  • Check the health by BackendInst.Healthy() before redirection. If it's unhealthy, abort redirection
  • Add locks to backendWrapper because status may be read and written concurrently
  • Add a parameter removeEmpty to adjustBackendList and pass false to it in ensureBackend

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Notable changes

  • Has configuration change
  • Has HTTP API interfaces change
  • Has tiproxyctl change
  • Other user behavior changes

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot requested review from bb7133 and xhebox December 14, 2023 10:36
@ti-chi-bot ti-chi-bot bot added the size/XL label Dec 14, 2023
Copy link

ti-chi-bot bot commented Dec 15, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: xhebox

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the lgtm label Dec 15, 2023
Copy link

ti-chi-bot bot commented Dec 15, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-12-15 02:18:57.340440743 +0000 UTC m=+581828.377667666: ☑️ agreed by xhebox.

@ti-chi-bot ti-chi-bot bot added the approved label Dec 15, 2023
@ti-chi-bot ti-chi-bot bot merged commit 12a17a1 into pingcap:main Dec 15, 2023
9 checks passed
@djshow832 djshow832 deleted the redirect_check branch December 15, 2023 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid connecting to unhealthy TiDB during session migration
2 participants