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

ddl: fix rename index for expression indexes #51984

Merged
merged 5 commits into from
Apr 8, 2024

Conversation

ywqzzy
Copy link
Contributor

@ywqzzy ywqzzy commented Mar 21, 2024

What problem does this PR solve?

Issue Number: close #51431

Problem Summary:
Rename the virtual generated column when rename idx.

What changed and how does it work?

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-tests-checked do-not-merge/needs-triage-completed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed do-not-merge/needs-tests-checked labels Mar 21, 2024
Copy link

tiprow bot commented Mar 21, 2024

Hi @ywqzzy. 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/test-infra repository.

Copy link
Collaborator

@Benjamin2037 Benjamin2037 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Mar 21, 2024
Copy link

codecov bot commented Mar 21, 2024

Codecov Report

Merging #51984 (90dabd2) into master (ac057eb) will decrease coverage by 13.7054%.
Report is 359 commits behind head on master.
The diff coverage is 90.0000%.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #51984         +/-   ##
=================================================
- Coverage   70.7350%   57.0297%   -13.7054%     
=================================================
  Files          1462       1687        +225     
  Lines        435268     666300     +231032     
=================================================
+ Hits         307887     379989      +72102     
- Misses       108112     261845     +153733     
- Partials      19269      24466       +5197     
Flag Coverage Δ
integration 37.8131% <85.0000%> (?)
unit 71.4598% <55.0000%> (+0.9227%) ⬆️

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

Components Coverage Δ
dumpling 53.9957% <ø> (ø)
parser ∅ <ø> (∅)
br 50.4664% <ø> (+4.6044%) ⬆️

Copy link
Contributor

@zimulala zimulala left a comment

Choose a reason for hiding this comment

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

Do we need to update this PR's title? This PR like to fix rename index for expression indexes.

pkg/ddl/index.go Outdated Show resolved Hide resolved
@ywqzzy ywqzzy changed the title ddl: fix rename index forgot to rename the virtual generated column ddl: fix rename index for expression indexes Mar 25, 2024
@ywqzzy ywqzzy requested a review from zimulala March 25, 2024 08:39
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Mar 25, 2024
Copy link

ti-chi-bot bot commented Mar 25, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-03-21 08:40:48.032108367 +0000 UTC m=+1538875.054354753: ☑️ agreed by Benjamin2037.
  • 2024-03-25 08:44:09.343337096 +0000 UTC m=+1884676.365583484: ☑️ agreed by zimulala.

Copy link

tiprow bot commented Mar 25, 2024

@ywqzzy: 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
tidb_parser_test 725e2e6 link true /test tidb_parser_test
fast_test_tiprow 725e2e6 link true /test fast_test_tiprow

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/test-infra repository. I understand the commands that are listed here.

pkg/ddl/index.go Outdated
Comment on lines 2569 to 2576
func renameHiddenColumns(tblInfo *model.TableInfo, from, to model.CIStr) {
for _, col := range tblInfo.Columns {
if getExpressionIndexOriginName(col) == from.O {
col.Name.L = strings.Replace(col.Name.L, from.L, to.L, 1)
col.Name.O = strings.Replace(col.Name.O, from.O, to.O, 1)
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use Column.Hidden to filter hidden columns, otherwise it may cause unexpected behavior if there is a column name contains only one char like _, V or $.

@tangenta
Copy link
Contributor

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 25, 2024
@ywqzzy ywqzzy requested a review from tangenta March 26, 2024 06:48
@tangenta
Copy link
Contributor

tangenta commented Apr 8, 2024

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 8, 2024
Copy link

ti-chi-bot bot commented Apr 8, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Benjamin2037, tangenta, zimulala

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

@ywqzzy
Copy link
Contributor Author

ywqzzy commented Apr 8, 2024

/retest

Copy link

tiprow bot commented Apr 8, 2024

@ywqzzy: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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/test-infra repository.

@ti-chi-bot ti-chi-bot bot merged commit 23f6237 into pingcap:master Apr 8, 2024
21 checks passed
@ti-chi-bot ti-chi-bot added the needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. label Apr 12, 2024
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Apr 12, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot bot pushed a commit that referenced this pull request Apr 16, 2024
@ti-chi-bot ti-chi-bot added the needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. label May 7, 2024
@ti-chi-bot
Copy link
Member

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

@lance6716
Copy link
Contributor

/cherry-pick release-6.5

@ti-chi-bot
Copy link
Member

@lance6716: new pull request created to branch release-6.5: #53737.

In response to this:

/cherry-pick release-6.5

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 ti-community-infra/tichi repository.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jun 3, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot bot pushed a commit that referenced this pull request Jun 5, 2024
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-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. release-note-none Denotes a PR that doesn't merit a release note. 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.

rename index forgot to rename the virtual generated column
6 participants