Skip to content

Support TiDB smooth upgrade in v2#6933

Draft
tennix wants to merge 1 commit into
mainfrom
feature/v2-tidb-smooth-upgrade
Draft

Support TiDB smooth upgrade in v2#6933
tennix wants to merge 1 commit into
mainfrom
feature/v2-tidb-smooth-upgrade

Conversation

@tennix

@tennix tennix commented Jun 9, 2026

Copy link
Copy Markdown
Member

What is changed

This PR adds TiDB smooth-upgrade orchestration to tidb-operator v2:

  • extend the v2 TiDB API client with bodyless POST /upgrade/start and POST /upgrade/finish
  • call /upgrade/start before switch-controlled TiDBGroup version rollouts mutate TiDB instance CRs
  • persist active pause state in controller-owned TiDBGroup annotations
  • recover stale/mismatched annotations by calling idempotent /upgrade/finish before clearing them
  • call /upgrade/finish after all TiDB instances are on the target version/revision and Ready
  • add an RFC for the v2 design

Notes

The behavior follows the v1 smooth-upgrade support from #6904, adapted to the v2 TiDBGroup/TiDB instance reconciliation model.

Tests

PASS go test ./pkg/tidbapi/v1 ./pkg/controllers/tidb ./pkg/controllers/tidb/tasks ./pkg/controllers/tidbgroup ./pkg/controllers/tidbgroup/tasks -count=1
PASS go test ./pkg/controllers/... -count=1
PASS git diff --check

Add TiDB smooth-upgrade orchestration to the v2 TiDBGroup controller. Switch-controlled TiDB version upgrades now call /upgrade/start before mutating TiDB instances, persist controller-owned pause annotations, recover stale annotation state with idempotent finish, and call /upgrade/finish after the group is fully updated and ready. Extend the v2 TiDB API client with start/finish methods and document the design in an RFC.\n\nTested: go test ./pkg/tidbapi/v1 ./pkg/controllers/tidb ./pkg/controllers/tidb/tasks ./pkg/controllers/tidbgroup ./pkg/controllers/tidbgroup/tasks -count=1\nTested: go test ./pkg/controllers/... -count=1\nTested: git diff --check
@ti-chi-bot

ti-chi-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

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 a review from shonge June 9, 2026 11:18
@ti-chi-bot

ti-chi-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

[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 azurezyq 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

@github-actions github-actions Bot added the v2 for operator v2 label Jun 9, 2026
@ti-chi-bot ti-chi-bot Bot added the size/XXL label Jun 9, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 74.58333% with 61 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.64%. Comparing base (6941259) to head (71ae347).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6933      +/-   ##
==========================================
+ Coverage   39.30%   39.64%   +0.34%     
==========================================
  Files         430      431       +1     
  Lines       24310    24550     +240     
==========================================
+ Hits         9554     9733     +179     
- Misses      14756    14817      +61     
Flag Coverage Δ
unittest 39.64% <74.58%> (+0.34%) ⬆️

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

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

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.

2 participants