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

infoschema: rewrite SchemaSimpleTableInfos for infoschema v2 to avoid network #55088

Merged
merged 4 commits into from
Aug 6, 2024

Conversation

tiancaiamao
Copy link
Contributor

@tiancaiamao tiancaiamao commented Jul 31, 2024

What problem does this PR solve?

Issue Number: ref #50959

Problem Summary:

What changed and how does it work?

HTTP API for schema table is a burden for infoschema v2 when there are a lot of tables.
In the past, we have change SchemaTable to SimpleSchemaTableInfos, i.e. from full model.TableInfo to model.TableNameInfo to reduce the cost.

SimpleSchemaTableInfos fetch the table name and id using meta API, fetch data from tikv.
As we store all the name->id mapping now, we can avoid the network API.

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/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 31, 2024
Copy link

tiprow bot commented Jul 31, 2024

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

Copy link

codecov bot commented Jul 31, 2024

Codecov Report

Attention: Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.

Project coverage is 73.4399%. Comparing base (a187e9d) to head (7bdbea5).
Report is 36 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #55088        +/-   ##
================================================
+ Coverage   72.8506%   73.4399%   +0.5893%     
================================================
  Files          1562       1576        +14     
  Lines        439181     458644     +19463     
================================================
+ Hits         319946     336828     +16882     
- Misses        99531     101095      +1564     
- Partials      19704      20721      +1017     
Flag Coverage Δ
integration 49.5980% <0.0000%> (?)
unit 71.7617% <95.2381%> (-0.0848%) ⬇️

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

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

@tiancaiamao
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented Jul 31, 2024

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

@tiancaiamao
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented Aug 1, 2024

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

@tiancaiamao
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented Aug 1, 2024

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

retry:
dbInfo, ok := is.SchemaByName(schema)
if !ok {
// Ascend is much more difficult than Descend.
Copy link
Contributor

Choose a reason for hiding this comment

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

what do you mean by difficult, difficult to implement?

Copy link
Contributor Author

@tiancaiamao tiancaiamao Aug 1, 2024

Choose a reason for hiding this comment

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

Handle it in Ascend order is more difficult than handle it in Descend order.

The data organize like this:

| t1                      | t2     | t3    |
| v5  v6  v7  v8 v10  v12 | v7 v13 | v12 v15 |

If we want infoschma snapshot at v10, the result should be [t1.v10 t2.v7]

In Descend order, the total test condition could be:

if is.infoSchema.schemaMetaVersion >= item.schemaVersion {
    if curr == nil || curr.tableName != tableItems[i].tableName {
          // add curr to the result
    }
}

But in Ascend order, you may have a try to see how much more difficult

:-)

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Aug 1, 2024
Copy link

ti-chi-bot bot commented Aug 6, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lance6716, 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 6, 2024
Copy link

ti-chi-bot bot commented Aug 6, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-01 09:32:27.172858232 +0000 UTC m=+434663.452906301: ☑️ agreed by lance6716.
  • 2024-08-06 07:13:30.187457074 +0000 UTC m=+336140.054556161: ☑️ agreed by wjhuang2016.

Copy link

ti-chi-bot bot commented Aug 6, 2024

@tiancaiamao: 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
idc-jenkins-ci-tidb/check_dev 7bdbea5 link unknown /test check-dev

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.

@tiancaiamao
Copy link
Contributor Author

/test check-dev

Copy link

tiprow bot commented Aug 6, 2024

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

In response to this:

/test check-dev

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 merged commit 1fb4019 into pingcap:master Aug 6, 2024
20 of 23 checks passed
@tiancaiamao tiancaiamao deleted the simple-table-info branch August 6, 2024 08:11
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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants