-
Notifications
You must be signed in to change notification settings - Fork 6k
*: support fast admin check for multi-value index #60650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Hi @joechenrh. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. 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. |
Codecov Report❌ Patch coverage is Please upload reports for the commit 337a8f4 to get more accurate results. Additional details and impacted files@@ Coverage Diff @@
## master #60650 +/- ##
================================================
+ Coverage 72.8056% 73.1749% +0.3693%
================================================
Files 1823 1828 +5
Lines 494595 498374 +3779
================================================
+ Hits 360093 364685 +4592
+ Misses 112624 111727 -897
- Partials 21878 21962 +84
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Signed-off-by: Ruihao Chen <[email protected]>
Signed-off-by: Ruihao Chen <[email protected]>
Signed-off-by: Ruihao Chen <[email protected]>
Signed-off-by: Ruihao Chen <[email protected]>
Signed-off-by: Ruihao Chen <[email protected]>
Signed-off-by: Ruihao Chen <[email protected]>
/retest |
@joechenrh: Cannot trigger testing until a trusted user reviews the PR and leaves an 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. |
Signed-off-by: Ruihao Chen <[email protected]>
Signed-off-by: Ruihao Chen <[email protected]>
Signed-off-by: Ruihao Chen <[email protected]>
Signed-off-by: Ruihao Chen <[email protected]>
/retest |
@joechenrh: Cannot trigger testing until a trusted user reviews the PR and leaves an 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 |
@joechenrh: Cannot trigger testing until a trusted user reviews the PR and leaves an 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. |
Signed-off-by: Ruihao Chen <[email protected]>
Signed-off-by: Ruihao Chen <[email protected]>
/retest |
@joechenrh: Cannot trigger testing until a trusted user reviews the PR and leaves an 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. |
Signed-off-by: Ruihao Chen <[email protected]>
/retest |
@joechenrh: Cannot trigger testing until a trusted user reviews the PR and leaves an 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. |
Signed-off-by: Ruihao Chen <[email protected]>
Signed-off-by: Ruihao Chen <[email protected]>
@@ -4248,6 +4249,38 @@ func getLatestVersionFromStatsTable(ctx sessionctx.Context, tblInfo *model.Table | |||
return version | |||
} | |||
|
|||
// buildTableForAdminCheckSQL make a copy of table info if necessary. | |||
// Since we want to utilize MVIndex to read the data in FAST ADMIN CHECK, to prevent from adding | |||
// many hacky code in the planner module, we craete a new table info with all MVIndex-related meta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For previous hacky code, you find them in https://github.com/pingcap/tidb/pull/60650/files/07651fc8654251b0469088b8b9c7e9ce898edb11#diff-55cc0d68cf49733ba3cda18aa3f3797fc61599ae9bcf09f4246da019b510beba
Signed-off-by: Ruihao Chen <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: hawkingrei The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
Signed-off-by: Ruihao Chen <[email protected]>
Signed-off-by: Ruihao Chen <[email protected]>
Signed-off-by: Ruihao Chen <[email protected]>
Signed-off-by: Ruihao Chen <[email protected]>
@joechenrh: The following tests failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
What problem does this PR solve?
Issue Number: close #60649
Problem Summary:
As title, this PR add support for fast multi-value index check.
The rationale can be found in the linked issue, let's just take a simple schema as example here:
To check the data-consistency for index
mvi
, we need to read the below columns from table side and index side respectivelySELECT i1, i2, j FROM t USE INDEX()
SELECT i1, i2, _V$_mvi_0 FROM t USE INDEX(mvi)
Here
_V$_mvi_0
is the hidden column generated by multi-valued index, and we use this column to scan the whole index.After retrieving the data, we can calculate the checksum and detect the inconsistent record.
What changed and how does it work?
The changes in this PR can be divided into three parts:
Support for Fast Admin Checks on MV Indexes:
This PR enhances support for multi-valued (MV) indexes in FAST ADMIN CHECK TABLE with some restricted column types.
We implement separate logic to generate checksum SQL for MV indexes. Unlike normal indexes that use
BIT_XOR
to aggregate per-row checksums, we simply useSUM
for MV indexes. It's necessary because calculating per-rowchecksum for multi-valued index is impractical.
Optimizer Adaptations:
Previously, the usage of multi-valued index is limited to index merge. To support reading data from MV index via SQL, we add some new logic:
IsMVIndex
for index andHidden
for index columns) in table meta. So optimizer can treat this table as normal table.Adjustments to the
JSON_SUM_CRC32
Function:To align index-side and table-side calculations, we modified the internal implementation of
JSON_SUM_CRC32
:MOD
to calculated crc32 value to prevent overflowCheck List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.