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: Add Revision check in tryLockMDLAndUpdateSchemaIfNecessary #54963

Merged
merged 3 commits into from
Aug 2, 2024

Conversation

joechenrh
Copy link
Contributor

@joechenrh joechenrh commented Jul 26, 2024

What problem does this PR solve?

Issue Number: close #54779

What changed and how does it work?

Before checking table change by comparing TableInfo, we can just examine Revision first to skip unnecessary checks. Besides, I also found that column comparation is done by double loop, which can use map.

// Check the table change, if adding new public index or modify a column, we need to handle them.
if !sctx.GetSessionVars().IsPessimisticReadConsistency() {

Using a table containing more than 1000 columns to test.

Before:

before

After:

Screenshot 2024-07-26 at 17 15 57

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. sig/planner SIG: Planner labels Jul 26, 2024
Copy link

ti-chi-bot bot commented Jul 26, 2024

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

@ti-chi-bot ti-chi-bot bot added needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 26, 2024
Copy link

tiprow bot commented Jul 26, 2024

Hi @joechenrh. 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 needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jul 29, 2024
var copyTableInfo *model.TableInfo

infoIndices := make(map[string]int64, len(tableInfo.Indices))
Copy link
Collaborator

Choose a reason for hiding this comment

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

A indexID to indexName mapping with type map[int64]int64 maybe more efficient in map searching

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jul 29, 2024
Copy link

ti-chi-bot bot commented Jul 29, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-07-29 06:45:52.699286586 +0000 UTC m=+165468.979334656: ☑️ agreed by wjhuang2016.
  • 2024-07-29 07:08:53.518818338 +0000 UTC m=+166849.798866400: ☑️ agreed by lcwangchao.

Copy link

codecov bot commented Jul 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.8175%. Comparing base (e0e8f89) to head (ab606c1).
Report is 58 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #54963        +/-   ##
================================================
+ Coverage   72.6985%   76.8175%   +4.1190%     
================================================
  Files          1560       1575        +15     
  Lines        438485     455827     +17342     
================================================
+ Hits         318772     350155     +31383     
+ Misses       100049      85313     -14736     
- Partials      19664      20359       +695     
Flag Coverage Δ
integration 52.6315% <64.7058%> (?)
unit 73.1848% <100.0000%> (+1.4964%) ⬆️

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

Components Coverage Δ
dumpling 52.9567% <ø> (ø)
parser ∅ <ø> (∅)
br 62.7873% <ø> (+16.8830%) ⬆️

@lance6716
Copy link
Contributor

/assign @qw4990

Copy link

ti-chi-bot bot commented Aug 1, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lcwangchao, qw4990, wjhuang2016

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 the approved label Aug 1, 2024
@qw4990
Copy link
Contributor

qw4990 commented Aug 1, 2024

Do we need to back port this to v8.1 or v7.5?

@wjhuang2016
Copy link
Member

/retest

2 similar comments
@wjhuang2016
Copy link
Member

/retest

@joechenrh
Copy link
Contributor Author

/retest

Copy link

ti-chi-bot bot commented Aug 1, 2024

@joechenrh: 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.

Copy link

tiprow bot commented Aug 1, 2024

@joechenrh: 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-sigs/prow repository.

@lance6716
Copy link
Contributor

/retest

Copy link

tiprow bot commented Aug 2, 2024

@lance6716: 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-sigs/prow repository.

@lance6716
Copy link
Contributor

/retest

Copy link

tiprow bot commented Aug 2, 2024

@lance6716: 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-sigs/prow repository.

@Benjamin2037
Copy link
Collaborator

/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 Aug 2, 2024
@joechenrh
Copy link
Contributor Author

/retest-required

Copy link

tiprow bot commented Aug 2, 2024

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

Test name Commit Details Required Rerun command
fast_test_tiprow ab606c1 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-sigs/prow repository. I understand the commands that are listed here.

@ti-chi-bot ti-chi-bot bot merged commit efd57c6 into pingcap:master Aug 2, 2024
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm 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.

Significant CPU usage for tryLockMDLAndUpdateSchemaIfNecessary for insert statement on table over 1k columns
6 participants