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/core: define extractors for sequences and constraints memtables #55257

Merged
merged 8 commits into from
Aug 14, 2024

Conversation

tangenta
Copy link
Contributor

@tangenta tangenta commented Aug 7, 2024

What problem does this PR solve?

Issue Number: ref #50305

Problem Summary:

What changed and how does it work?

  • Add extractor for infoschema.TableSequences , infoschema.TableReferConst, infoschema.TableCheckConstraints and infoschema.TableTiDBCheckConstraints.
  • Add functional tests for above extractors.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    Tested on schema_cache_size = 2GB.
    Prepare 20000 schemas and 2 tables for each schema:
    createParentSQL := "CREATE TABLE db%d.parent%d (id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (id));"
    createChildSQL := `			
        CREATE TABLE db%d.child%d (
        id INT NOT NULL AUTO_INCREMENT,
        name varchar(255) NOT NULL,
        parent_id INT DEFAULT NULL,
        PRIMARY KEY (id),
        CONSTRAINT fk_parent FOREIGN KEY (parent_id) REFERENCES db%d.parent%d (id) ON UPDATE CASCADE ON DELETE RESTRICT
        );`
    
    Before this PR:
    mysql> select fk.referenced_table_name, fk.referenced_column_name, fk.column_name, fk.constraint_name, rc.update_rule, rc.delete_rule from information_schema.referential_constraints rc join information_schema.key_column_usage fk using (constraint_schema, constraint_name) where rc.table_name  = 'child11' and fk.table_name = 'child11';
    +-----------------------+------------------------+-------------+-----------------+-------------+-------------+
    | referenced_table_name | referenced_column_name | column_name | constraint_name | update_rule | delete_rule |
    +-----------------------+------------------------+-------------+-----------------+-------------+-------------+
    | parent11              | id                     | parent_id   | fk_parent       | CASCADE     | RESTRICT    |
    +-----------------------+------------------------+-------------+-----------------+-------------+-------------+
    1 row in set (11.27 sec)
    
    After this PR:
    mysql> select fk.referenced_table_name, fk.referenced_column_name, fk.column_name, fk.constraint_name, rc.update_rule, rc.delete_rule from information_schema.referential_constraints rc join information_schema.key_column_usage fk using (constraint_schema, constraint_name) where rc.table_name  = 'child11' and fk.table_name = 'child11';
    +-----------------------+------------------------+-------------+-----------------+-------------+-------------+
    | referenced_table_name | referenced_column_name | column_name | constraint_name | update_rule | delete_rule |
    +-----------------------+------------------------+-------------+-----------------+-------------+-------------+
    | parent11              | id                     | parent_id   | fk_parent       | CASCADE     | RESTRICT    |
    +-----------------------+------------------------+-------------+-----------------+-------------+-------------+
    1 row in set (0.01 sec)
    
  • 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 do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked 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. labels Aug 7, 2024
Copy link

tiprow bot commented Aug 7, 2024

Hi @tangenta. 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.

@tangenta tangenta marked this pull request as draft August 7, 2024 07:50
@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 Aug 7, 2024
@tangenta tangenta changed the title planner/core: define extractors for indexes and constraints memtables planner/core: define extractors for sequences and constraints memtables Aug 9, 2024
@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 13, 2024
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked labels Aug 13, 2024
@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 13, 2024
@tangenta tangenta marked this pull request as ready for review August 13, 2024 08:19
@ti-chi-bot ti-chi-bot bot removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Aug 13, 2024
Copy link

codecov bot commented Aug 13, 2024

Codecov Report

Attention: Patch coverage is 75.49669% with 37 lines in your changes missing coverage. Please review.

Project coverage is 74.7852%. Comparing base (eeb3d73) to head (b140ff1).
Report is 4 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #55257        +/-   ##
================================================
- Coverage   74.8640%   74.7852%   -0.0788%     
================================================
  Files          1576       1577         +1     
  Lines        365691     440960     +75269     
================================================
+ Hits         273771     329773     +56002     
- Misses        72108      90933     +18825     
- Partials      19812      20254       +442     
Flag Coverage Δ
integration 49.0718% <74.8344%> (?)
unit 71.9119% <45.0331%> (-1.9186%) ⬇️

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

Components Coverage Δ
dumpling 52.9567% <ø> (-2.2327%) ⬇️
parser ∅ <ø> (∅)
br 52.5429% <ø> (+4.7449%) ⬆️

@tangenta
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented Aug 13, 2024

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

@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 14, 2024
@ti-chi-bot ti-chi-bot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 14, 2024
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Aug 14, 2024
Copy link

ti-chi-bot bot commented Aug 14, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hawkingrei, 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 approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 14, 2024
Copy link

ti-chi-bot bot commented Aug 14, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-14 08:17:22.940580243 +0000 UTC m=+342327.644049884: ☑️ agreed by wjhuang2016.
  • 2024-08-14 08:59:42.094639787 +0000 UTC m=+344866.798109429: ☑️ agreed by hawkingrei.

@ti-chi-bot ti-chi-bot bot merged commit aa4e2b3 into pingcap:master Aug 14, 2024
21 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 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.

3 participants