feat: pause DDL during TiDB version upgrade (smooth upgrade)#6892
feat: pause DDL during TiDB version upgrade (smooth upgrade)#6892tennix wants to merge 1 commit into
Conversation
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #6892 +/- ##
==========================================
+ Coverage 37.44% 37.77% +0.33%
==========================================
Files 392 393 +1
Lines 22432 22572 +140
==========================================
+ Hits 8399 8526 +127
- Misses 14033 14046 +13
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Introduce /upgrade/start and /upgrade/finish lifecycle hooks in the TiDBGroup reconciliation loop, mirroring TiUP's smooth upgrade behavior. - Before rolling upgrade begins, call POST /upgrade/start on a healthy TiDB instance to pause DDL (global for Dedicated, keyspace-scoped for Premium / TiDB Worker). - After all instances reach the new version, call POST /upgrade/finish to resume DDL. - Guards: only fires when spec.version changes AND both source and target versions support smooth upgrade (>= v7.5.0); no-op for scale/config changes. - Annotation tidb.core.pingcap.com/smooth-upgrade-phase tracks in-flight state across operator restarts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
8229389 to
dd778a7
Compare
Summary
/upgrade/startand/upgrade/finishlifecycle hooks in theTiDBGroupreconciliation loop, mirroring TiUP's smooth upgrade behaviorTaskSmoothUpgradeStartruns beforeTaskUpdaterto pause DDL;TaskSmoothUpgradeFinishruns afterTaskStatusRevisionAndReplicasto resume DDLtidb.core.pingcap.com/smooth-upgrade-phase: in-progress) tracks in-flight state across operator restartsBehavior
The keyspace value from
spec.template.spec.keyspaceis passed directly to/upgrade/start.Guards:
spec.versionchanges (not scale in/out or config changes)/upgrade/startfails, rolling upgrade is blocked (retried) — no pods restart without a successful DDL pauseChanges
api/core/v1alpha1/tidb_types.go— annotation key/value constantspkg/tidbapi/v1/types.go—UpgradeRequeststructpkg/tidbapi/v1/client.go—UpgradeStart+UpgradeFinishonTiDBClientinterfacepkg/compatibility/semver.go—SupportsSmoothUpgrade(version) boolpkg/controllers/tidbgroup/tasks/upgrade.go— newTaskSmoothUpgradeStart+TaskSmoothUpgradeFinishpkg/controllers/tidbgroup/builder.go— wire new tasks into reconciliation loopTest plan
make testpasses (unit tests for new tasks, HTTP client methods, semver helper)/upgrade/startbody contains keyspace name🤖 Generated with Claude Code