-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
server: refine the connection counter logic #54546
Conversation
…ts before handshake successfully Signed-off-by: Yang Keao <yangkeao@chunibyo.icu>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #54546 +/- ##
=================================================
- Coverage 72.8839% 57.1109% -15.7731%
=================================================
Files 1523 1672 +149
Lines 435584 629739 +194155
=================================================
+ Hits 317471 359650 +42179
- Misses 98568 246485 +147917
- Partials 19545 23604 +4059
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/retest |
/retest |
[LGTM Timeline notifier]Timeline:
|
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: easonn7, tiancaiamao, 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 |
/retest |
1 similar comment
/retest |
@YangKeao: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
What problem does this PR solve?
Issue Number: close #54545, close #54428
Problem Summary:
This PR solve two problems:
registerConn
, and decreases inconn.Close()
(if theconn.getCtx()
is not nil). If the connection exists before handshake successfully, for example authentication failed, the total connection count will decrease one 🤦.SET SESSION_STATES
(usually used bytiproxy
) didn't INC/DEC the connection count for the resource group if it's changed.What changed and how does it work?
This PR reorganized the codes INC/DEC the metric gauge in the following pattern:
newConn
with default resource group name, so that it can make sure the connection count will always increase.closeConn
. If the connection doesn't have a valid context, it'll decrease in the default resource group.Other use case of the
ConnGauge
always comes in pair: increase one and decrease another one. This PR provides a methodSetResourceGroupName
to change the session vars and always INC/DEC the metric counter. It'll be called inSET SESSION_STATES
,SET RESOURCE GROUP
and authentication (because the user may carry a resource group info).Check List
Tests
Release note