Skip to content

backendcluster: add cluster manager and cluster-scoped topology runtime#1104

Merged
ti-chi-bot[bot] merged 3 commits intopingcap:mainfrom
YangKeao:pr/03-multi-cluster-runtime
Apr 2, 2026
Merged

backendcluster: add cluster manager and cluster-scoped topology runtime#1104
ti-chi-bot[bot] merged 3 commits intopingcap:mainfrom
YangKeao:pr/03-multi-cluster-runtime

Conversation

@YangKeao
Copy link
Copy Markdown
Member

@YangKeao YangKeao commented Mar 19, 2026

What problem does this PR solve?

Issue Number: close #1098

What is changed and how it works:

Introduce a backend-cluster manager that owns cluster-scoped runtime instances.

This PR adds:

  • a manager for configured backend clusters
  • one runtime per backend cluster
  • cluster-scoped etcd / infosync / shared clients
  • topology aggregation across clusters
  • dynamic add / update / remove handling when backend-cluster config changes

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

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 ti-chi-bot bot requested review from bb7133 and xhebox March 19, 2026 16:45
@ti-chi-bot ti-chi-bot bot added the size/XXL label Mar 19, 2026
@YangKeao YangKeao force-pushed the pr/03-multi-cluster-runtime branch from 98ea284 to 3993ee3 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
Copy Markdown

codecov-commenter commented Mar 19, 2026

Codecov Report

❌ Patch coverage is 68.75000% with 110 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@4d841da). Learn more about missing BASE report.

Files with missing lines Patch % Lines
pkg/manager/backendcluster/manager.go 64.88% 47 Missing and 12 partials ⚠️
pkg/manager/backendcluster/cluster.go 63.88% 11 Missing and 2 partials ⚠️
pkg/balance/router/group.go 59.09% 9 Missing ⚠️
pkg/server/server.go 58.82% 6 Missing and 1 partial ⚠️
pkg/balance/observer/health_check.go 44.44% 4 Missing and 1 partial ⚠️
pkg/proxy/backend/backend_conn_mgr.go 54.54% 4 Missing and 1 partial ⚠️
pkg/balance/router/router.go 55.55% 4 Missing ⚠️
pkg/balance/router/router_static.go 0.00% 4 Missing ⚠️
pkg/manager/namespace/manager.go 0.00% 3 Missing ⚠️
pkg/manager/backendcluster/backend_id.go 90.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1104   +/-   ##
=======================================
  Coverage        ?   67.09%           
=======================================
  Files           ?      144           
  Lines           ?    15081           
  Branches        ?        0           
=======================================
  Hits            ?    10118           
  Misses          ?     4270           
  Partials        ?      693           
Flag Coverage Δ
unit 67.09% <68.75%> (?)

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
Copy Markdown
Member Author

/test all

@YangKeao
Copy link
Copy Markdown
Member Author

TestLocalDirWatcher is not stable. Let me try to stablize it.

/retest

@YangKeao YangKeao force-pushed the pr/03-multi-cluster-runtime branch 2 times, most recently from 25a54ca to cd317e4 Compare March 20, 2026 06:20
@YangKeao
Copy link
Copy Markdown
Member Author

/test all

@YangKeao YangKeao force-pushed the pr/03-multi-cluster-runtime branch 7 times, most recently from f97603c to 1add4f8 Compare March 24, 2026 13:52
@YangKeao YangKeao marked this pull request as ready for review March 24, 2026 13:57
@YangKeao YangKeao force-pushed the pr/03-multi-cluster-runtime branch from 1add4f8 to af488c9 Compare March 24, 2026 14:21
@djshow832
Copy link
Copy Markdown
Collaborator

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 82ae03a9dc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@YangKeao YangKeao force-pushed the pr/03-multi-cluster-runtime branch 3 times, most recently from 09b1223 to dfe1eac Compare March 31, 2026 16:01
@YangKeao YangKeao force-pushed the pr/03-multi-cluster-runtime branch from dfe1eac to e9c14ce Compare March 31, 2026 16:27
@YangKeao YangKeao requested a review from djshow832 April 1, 2026 02:32
StatusPort: 10080, // impossible anyway
},
g.lg.Warn("backend is not found in the router", zap.String("backend_id", backendID), zap.Stack("stack"))
backend = newBackendWrapper(backendID, observer.BackendHealth{
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why remove BackendInfo here? Is it safe to remove it?

Copy link
Copy Markdown
Member Author

@YangKeao YangKeao Apr 2, 2026

Choose a reason for hiding this comment

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

A mistake. I tried to find some way to fill in these fields without parsing backendID but failed.

For now, I think it's fine to parse backendID for this strange branch.

@YangKeao YangKeao force-pushed the pr/03-multi-cluster-runtime branch from c6b881d to c6de019 Compare April 2, 2026 09:28
Signed-off-by: Yang Keao <yangkeao@chunibyo.icu>
@YangKeao YangKeao force-pushed the pr/03-multi-cluster-runtime branch from c6de019 to d5daa9c Compare April 2, 2026 09:35
Signed-off-by: Yang Keao <yangkeao@chunibyo.icu>
@ti-chi-bot ti-chi-bot bot added the lgtm label Apr 2, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot bot commented Apr 2, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: djshow832

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

The pull request process is described 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
Copy link
Copy Markdown

ti-chi-bot bot commented Apr 2, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-04-02 11:16:13.190136948 +0000 UTC m=+436578.395497005: ☑️ agreed by djshow832.

@ti-chi-bot ti-chi-bot bot added the approved label Apr 2, 2026
@ti-chi-bot ti-chi-bot bot merged commit 30d5b3f into pingcap:main Apr 2, 2026
6 checks passed
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 cluster manager to manager cluster-scoped topology.

3 participants