Skip to content

ddl,tables: only write the index when it meets partial index condition#62762

Merged
ti-chi-bot[bot] merged 1 commit into
pingcap:masterfrom
YangKeao:partial-index-2
Nov 12, 2025
Merged

ddl,tables: only write the index when it meets partial index condition#62762
ti-chi-bot[bot] merged 1 commit into
pingcap:masterfrom
YangKeao:partial-index-2

Conversation

@YangKeao
Copy link
Copy Markdown
Member

@YangKeao YangKeao commented Aug 1, 2025

This is the second PR for partial index

#63448
#62759
-> #62762

What problem does this PR solve?

Issue Number: close #62761

Problem Summary:

What changed and how does it work?

  1. Modify the tables.index to parse/store the expression of partialConditionExpression.
  2. Add a MeetPartialCondition to check whether it'll meet the condition.
  3. Add some tests about the DML during the DDL on the same table.
  4. Modify the row count of admin show ddl job from the added count to the scanned count.
  5. Support admin check table for partial index.

Check List

Tests

  • Unit test
  • 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.

None

@ti-chi-bot ti-chi-bot Bot added release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. sig/planner SIG: Planner labels Aug 1, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 1, 2025

Codecov Report

❌ Patch coverage is 52.76873% with 290 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.9055%. Comparing base (f2abf53) to head (5e8e090).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #62762        +/-   ##
================================================
+ Coverage   72.7181%   74.9055%   +2.1874%     
================================================
  Files          1864       1888        +24     
  Lines        505545     514158      +8613     
================================================
+ Hits         367623     385133     +17510     
+ Misses       115594     105286     -10308     
- Partials      22328      23739      +1411     
Flag Coverage Δ
integration 48.1293% <27.2413%> (?)
unit 72.5268% <46.5798%> (+0.2327%) ⬆️

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

Components Coverage Δ
dumpling 52.8700% <ø> (ø)
parser ∅ <ø> (∅)
br 62.9573% <ø> (+16.7468%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@YangKeao YangKeao force-pushed the partial-index-2 branch 7 times, most recently from ac0a733 to 6009afe Compare August 8, 2025 04:11
@YangKeao
Copy link
Copy Markdown
Member Author

/retest

@YangKeao YangKeao force-pushed the partial-index-2 branch 13 times, most recently from 9f57ee7 to db0e6ef Compare August 27, 2025 15:51
@YangKeao YangKeao force-pushed the partial-index-2 branch 3 times, most recently from 4f0082c to 7807dc6 Compare August 28, 2025 12:24
@YangKeao
Copy link
Copy Markdown
Member Author

/retest

1 similar comment
@YangKeao
Copy link
Copy Markdown
Member Author

/retest

@YangKeao
Copy link
Copy Markdown
Member Author

YangKeao commented Oct 30, 2025

I have no idea why mysql-test failed for now. It seems that the newest master commit also failed.

@YangKeao
Copy link
Copy Markdown
Member Author

YangKeao commented Nov 3, 2025

/retest

Comment thread pkg/ddl/backfilling_operators.go Outdated
Comment thread pkg/ddl/index.go
for i, index := range indexes {
// If the `IndexRecordChunk.conditionPushed` is true and we have only 1 index, the `indexConditionCheckers`
// will not be initialized.
if index.Meta().HasCondition() && indexConditionCheckers != nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check indexConditionCheckers != nil is enough.

Copy link
Copy Markdown
Member Author

@YangKeao YangKeao Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not enough.

indexConditionCheckers is initialized with make([]func(row chunk.Row) (bool, error), len(w.indexes)). We should either check index.Meta().HasCondition() or indexConditionCheckers[i] != nil (they are the same meaning).

Comment thread pkg/executor/check_table_index.go Outdated
Comment thread pkg/executor/check_table_index.go Outdated
Comment thread pkg/executor/check_table_index.go Outdated
Comment thread pkg/table/tables/index.go
Copy link
Copy Markdown
Member

@wjhuang2016 wjhuang2016 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest LGTM

@YangKeao
Copy link
Copy Markdown
Member Author

YangKeao commented Nov 6, 2025

/hold

Waiting for @fzzf678 to review.

Comment thread br/tests/br_partial_index/run.sh Outdated
Copy link
Copy Markdown
Member

@winoros winoros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the planner part.

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented Nov 6, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-11-05 12:43:55.226073926 +0000 UTC m=+274084.669103804: ☑️ agreed by wjhuang2016.
  • 2025-11-06 13:44:35.117833051 +0000 UTC m=+364124.560862931: ☑️ agreed by winoros.

Comment thread pkg/ddl/backfilling_operators.go Outdated
Comment thread pkg/ddl/index_cop.go
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented Nov 10, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fzzf678, Leavrth, winoros, wjhuang2016

The full list of commands accepted by this bot can be found here.

The pull request process is described 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

@fzzf678
Copy link
Copy Markdown
Contributor

fzzf678 commented Nov 10, 2025

/unhold

@YangKeao
Copy link
Copy Markdown
Member Author

/retest

3 similar comments
@YangKeao
Copy link
Copy Markdown
Member Author

/retest

@YangKeao
Copy link
Copy Markdown
Member Author

/retest

@YangKeao
Copy link
Copy Markdown
Member Author

/retest

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented Nov 11, 2025

@YangKeao: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
non-block/pull-integration-e2e-test-next-gen 512d005 link false /test pull-integration-e2e-test-next-gen
non-block/pull-unit-test-next-gen 512d005 link false /test pull-unit-test-next-gen
non-block/pull-mysql-client-test-next-gen 512d005 link false /test pull-mysql-client-test-next-gen
non-block/pull-mysql-test-next-gen 512d005 link false /test pull-mysql-test-next-gen
non-block/pull-integration-realcluster-test-next-gen 12863b6 link false /test pull-integration-realcluster-test-next-gen

Full PR test history. Your PR dashboard.

Details

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.

Signed-off-by: Yang Keao <yangkeao@chunibyo.icu>
@ti-chi-bot
Copy link
Copy Markdown
Member

In response to a cherrypick label: new pull request created to branch release-8.5: #68833.
But this PR has conflicts, please resolve them!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modify the DML/DDL to only write index when the condition meets.

6 participants