Skip to content

router: add port-based routing groups#1106

Draft
YangKeao wants to merge 3 commits intopingcap:mainfrom
YangKeao:pr/05-multi-cluster-router-port
Draft

router: add port-based routing groups#1106
YangKeao wants to merge 3 commits intopingcap:mainfrom
YangKeao:pr/05-multi-cluster-router-port

Conversation

@YangKeao
Copy link
Member

@YangKeao YangKeao commented Mar 19, 2026

What problem does this PR solve?

Issue Number: close #1100

Add port-based routing to the score-based router.

This PR introduces:

  • routing-rule = "port"
  • routing by the SQL listener port
  • cluster-scoped port groups
  • cross-cluster port-conflict detection and blocking

What is changed and how it works:

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
Copy link

ti-chi-bot bot commented Mar 19, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot
Copy link

ti-chi-bot bot commented Mar 19, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign yangkeao for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

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

Details 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 size/XXL label Mar 19, 2026
@YangKeao YangKeao force-pushed the pr/05-multi-cluster-router-port branch from df7706a to f6dd0c1 Compare March 19, 2026 17:33
@YangKeao YangKeao marked this pull request as ready for review March 19, 2026 17:37
@ti-chi-bot ti-chi-bot bot requested a review from djshow832 March 19, 2026 17:37
@codecov-commenter
Copy link

codecov-commenter commented Mar 19, 2026

Codecov Report

❌ Patch coverage is 73.96694% with 189 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@ca24d03). Learn more about missing BASE report.

Files with missing lines Patch % Lines
pkg/manager/backendcluster/manager.go 64.31% 68 Missing and 18 partials ⚠️
pkg/manager/backendcluster/metrics_querier.go 65.51% 27 Missing and 3 partials ⚠️
lib/config/proxy.go 83.33% 15 Missing and 6 partials ⚠️
pkg/balance/router/port_conflict_detector.go 67.74% 7 Missing and 3 partials ⚠️
pkg/proxy/backend/backend_conn_mgr.go 38.46% 6 Missing and 2 partials ⚠️
pkg/server/server.go 61.11% 6 Missing and 1 partial ⚠️
pkg/balance/observer/health_check.go 44.44% 4 Missing and 1 partial ⚠️
pkg/balance/router/group.go 66.66% 5 Missing ⚠️
pkg/balance/router/router_score.go 95.69% 3 Missing and 1 partial ⚠️
pkg/balance/metricsreader/metrics_reader.go 78.57% 3 Missing ⚠️
... and 5 more
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1106   +/-   ##
=======================================
  Coverage        ?   67.21%           
=======================================
  Files           ?      145           
  Lines           ?    15259           
  Branches        ?        0           
=======================================
  Hits            ?    10256           
  Misses          ?     4303           
  Partials        ?      700           
Flag Coverage Δ
unit 67.21% <73.96%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@YangKeao
Copy link
Member Author

/test all

@YangKeao YangKeao force-pushed the pr/05-multi-cluster-router-port branch 2 times, most recently from ac6b145 to 76c923a Compare March 20, 2026 06:20
@YangKeao
Copy link
Member Author

/test all

@ti-chi-bot
Copy link

ti-chi-bot bot commented Mar 20, 2026

@YangKeao: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-unit-test 76c923a link true /test pull-unit-test
pull-mysql-connector-test 76c923a link true /test mysql-connector-test

Full PR test history. Your PR dashboard.

Details

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.

@YangKeao YangKeao force-pushed the pr/05-multi-cluster-router-port branch 6 times, most recently from 94c580b to 64cec42 Compare March 24, 2026 13:13
@YangKeao YangKeao force-pushed the pr/05-multi-cluster-router-port branch 2 times, most recently from ceba1e1 to 623fdb8 Compare March 24, 2026 14:08
Introduce the backend cluster manager, cluster-scoped InfoSync runtime, topology aggregation, and single-cluster compatibility hooks.
@YangKeao YangKeao force-pushed the pr/05-multi-cluster-router-port branch from 623fdb8 to 2b207b7 Compare March 24, 2026 14:21
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.

Add port-based routing rules and groups.

2 participants