Repository navigation
Conversation
|
[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 |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #72689 +/- ##
================================================
+ Coverage 72.1862% 73.6415% +1.4553%
================================================
Files 2173 2221 +48
Lines 601857 612203 +10346
================================================
+ Hits 434458 450836 +16378
+ Misses 167397 161362 -6035
- Partials 2 5 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Dropping or truncating a table deletes its affinity groups in PD, but RECOVER TABLE, FLASHBACK TABLE and FLASHBACK DATABASE restored the table metadata, including its affinity, without creating the groups again, so the recovered tables silently lost affinity scheduling. The recovery step now creates the affinity groups of the recovered tables after its checks that can cancel the job. Recovery rescues data that GC deletes soon, so failing to create the groups does not cancel it: the tables are recovered, the error is logged, and the statement returns a warning that names the tables, whose groups can be created again with ALTER TABLE ... AFFINITY. Creating groups is idempotent, so retrying the step is safe; a successful retry drops the warning of an earlier attempt. If a retry is cancelled after an earlier attempt created groups, the groups are kept rather than deleted: the same table ID can be recovered by another job, whose groups they then are. A later recovery or ALTER TABLE ... AFFINITY of the table takes them over. Fixes pingcap#72057 Signed-off-by: JmPotato <github@ipotato.me>
ecbe986 to
f996a99
Compare
|
Protected changes This pull request adds lines that a repository policy protects. Merge needs an approval from a reviewer listed for it.
Required reviewers: @zanmato1984, @windtalker, @bb7133, @terry1purcell, @cfzjywxk, @niubell, @nongfushanquan, @v01dstar, @XuHuaiyu, @YuJuncen (1 approval(s) needed). Update protected-change patterns and approvers at https://github.com/ti-community-infra/configs/blob/main/prow/config/protected_changes_config.yaml. This comment is updated on every push instead of adding a new one. |
|
/retest-required |
What problem does this PR solve?
Issue Number: close #72057
Problem Summary:
Dropping or truncating a table deletes its affinity groups in PD. RECOVER TABLE, FLASHBACK TABLE and FLASHBACK DATABASE restore the table metadata, including its affinity, but did not create the groups again, so the recovered tables silently lost affinity scheduling.
What changed and how does it work?
ALTER TABLE ... AFFINITY.ALTER TABLE ... AFFINITYof the table takes the kept groups over; nothing cleans them up automatically today; the reconciliation planned in ddl: garbage-collect and reconcile affinity groups in PD #72061 is meant to handle them. The log records which job sent a successful group-creation request for which table.Relation to #72677: until #72677 is merged, a PD that does not serve the affinity API answers group creation with 404, which TiDB treats as success, so recovery there leaves the tables without groups and without a warning. With #72677, the same case returns the warning above.
Check List
Tests
Manual test on a local cluster with TiKV v8.5.8 and PD master, running a
tidb-serverbuilt from this PR, with a table-level affinity tablet1and a partition-level affinity tabletp:DROP TABLE t1removes_tidb_t_<t1>;RECOVER TABLE t1restores the rows and the group, without warnings.DROP TABLE tpremoves its partition groups;FLASHBACK TABLE tp TO tp2restores_tidb_pt_<tp>_p<partition>for both partitions.DROP DATABASEremoves all groups;FLASHBACK DATABASErestores both tables, the rows and all three groups.Group-creation failure, retry of the recovery step, cancellation after a retry (groups kept and taken over by a later recovery) and two parallel recoveries of the same table are covered by unit tests with failpoints.
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
Summary by CodeRabbit