ddl: support to set and alter the `AFFINITY` for table
What problem does this PR solve?
Issue Number: ref #64938
What changed and how does it work?
- Support a new option
AFFINITYfor table, for example:
CREATE TABLE t(a int) AFFINITY 'table';
The above DDL indicates creating a table with a table-level affinity which will cluster all the table's data into one region.
-
Add a new column
TIDB_AFFINITYto tableinformation_schema.TABLESandinformation_schema.PARTITONS -
forbid add / drop / exchange / reorg partition on affinity table
Check List
Tests
- [ ] Unit test
- [x] Integration test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test
- [ ] I checked and no code files have been changed.
Side effects
- [ ] Performance regression: Consumes more CPU
- [ ] Performance regression: Consumes more Memory
- [ ] Breaking backward compatibility
Documentation
- [ ] Affects user behaviors
- [ ] Contains syntax changes
- [ ] Contains variable changes
- [ ] Contains experimental features
- [ ] Changes MySQL compatibility
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
support to set and alter the `AFFINITY` for table
Codecov Report
:x: Patch coverage is 72.77228% with 55 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 71.4647%. Comparing base (5271f75) to head (3ab80f3).
:warning: Report is 13 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #64988 +/- ##
================================================
+ Coverage 70.9053% 71.4647% +0.5594%
================================================
Files 1888 1889 +1
Lines 515654 519719 +4065
================================================
+ Hits 365626 371416 +5790
+ Misses 125622 123899 -1723
+ Partials 24406 24404 -2
| Flag | Coverage Δ | |
|---|---|---|
| integration | 48.2535% <70.4301%> (+0.0970%) |
:arrow_up: |
| unit | 66.0477% <22.7722%> (+0.4073%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Components | Coverage Δ | |
|---|---|---|
| dumpling | 52.8700% <ø> (ø) |
|
| parser | ∅ <ø> (∅) |
|
| br | 60.9232% <ø> (+1.5279%) |
:arrow_up: |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
/retest
/retest
/retest
/retest
/retest
/retest
/retest
/retest
A small question, do we need to ignore
PRE_SPLIT_REGIONSwhen AFFINITY is enabled. If I understand correctly,PRE_SPLIT_REGIONSwill split the region, and those regions will be merged by PD later again due to we need to maintain affinity.
good catch. But I think we do not need to handle it yet because it does not introduce any correctness problem.
good catch. But I think we do not need to handle it yet because it does not introduce any correctness problem.
LGTM
@lhy1024: adding LGTM is restricted to approvers and reviewers in OWNERS files.
In response to this:
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.
/retest
/retest
/retest
/retest
[LGTM Timeline notifier]
Timeline:
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: Benjamin2037, cfzjywxk, fzzf678, lhy1024, yudongusa
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [Benjamin2037,cfzjywxk]
- ~~pkg/ddl/OWNERS~~ [Benjamin2037]
- ~~pkg/infoschema/OWNERS~~ [Benjamin2037]
- ~~pkg/meta/OWNERS~~ [Benjamin2037]
- ~~pkg/parser/OWNERS~~ [Benjamin2037,yudongusa]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment