Skip to content
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

planner: Handle _tidb_rowid correctly in batchPointGet Plan to avoid index out of range error #58687

Merged
merged 4 commits into from
Jan 14, 2025

Conversation

dash12653
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #58581

Problem Summary:

What changed and how does it work?

If we only select _tidb_rowid in a batchPointGet Plan, _tidb_rowid would be treated as an extra column incorrectly, leading to panic when adjusting the schema.

I added a condition to make sure that the check for extra columns will only apply when there are multiple columns.

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. do-not-merge/needs-triage-completed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Jan 4, 2025
Copy link

ti-chi-bot bot commented Jan 4, 2025

Hi @dash12653. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@ti-chi-bot ti-chi-bot bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 4, 2025
Copy link

tiprow bot commented Jan 4, 2025

Hi @dash12653. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

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.

@ti-chi-bot ti-chi-bot bot added the sig/planner SIG: Planner label Jan 4, 2025
@hawkingrei
Copy link
Member

/ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Jan 5, 2025
Copy link

codecov bot commented Jan 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.9703%. Comparing base (35f329d) to head (f620465).
Report is 134 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #58687        +/-   ##
================================================
+ Coverage   73.1026%   73.9703%   +0.8676%     
================================================
  Files          1677       1680         +3     
  Lines        463652     478554     +14902     
================================================
+ Hits         338942     353988     +15046     
+ Misses       103883     103160       -723     
- Partials      20827      21406       +579     
Flag Coverage Δ
integration 42.9156% <100.0000%> (?)
unit 72.3454% <100.0000%> (+0.0607%) ⬆️

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

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 45.3984% <ø> (-0.3632%) ⬇️

@dash12653 dash12653 marked this pull request as draft January 5, 2025 16:23
@ti-chi-bot ti-chi-bot bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 5, 2025
@ti-chi-bot ti-chi-bot bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 5, 2025
@dash12653 dash12653 marked this pull request as ready for review January 5, 2025 19:45
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 5, 2025
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 6, 2025
@dash12653
Copy link
Contributor Author

Hi @Defined2014 , could you please review this pr when you have a chance? Thanks!

break
}
numExtraColumns++
}

if !ordinaryColumnExists {
Copy link
Contributor

@Defined2014 Defined2014 Jan 13, 2025

Choose a reason for hiding this comment

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

Better change it to

if ordinaryColumnExists && numExtraColumns > 0 {
    // do something
}

Then do extract dependent columns related things.

I think it's easier to understand the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, I will try modify the code.

@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 14, 2025
Copy link

ti-chi-bot bot commented Jan 14, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Defined2014, hawkingrei

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

The pull request process is described here

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

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 14, 2025
Copy link

ti-chi-bot bot commented Jan 14, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-01-06 07:22:33.901504041 +0000 UTC m=+165497.190335748: ☑️ agreed by hawkingrei.
  • 2025-01-14 02:40:21.680517272 +0000 UTC m=+839764.969349194: ☑️ agreed by Defined2014.

@ti-chi-bot ti-chi-bot bot merged commit ea5beb8 into pingcap:master Jan 14, 2025
23 of 24 checks passed
@ti-chi-bot ti-chi-bot bot added the needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. label Jan 24, 2025
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #59175.

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-6.5 Should cherry pick this PR to release-6.5 branch. ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Point get plan got error: runtime error: index out of range [-1]
4 participants