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,executor: change TableByID to skip refill infoschema v2 cache #55101

Merged
merged 8 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:

During "select * from INFORMATION_SCHEMA.TABLES where table_schema = 'test'", the schema cache hit ratio drop to nearly 0

image

What changed and how does it work?

It's cause by that the result need to show the next autoid info, so it calls TableByName.
And since this is a list API, the infoschema v2 cache is affect by the cache refill.

In this commit I change it to use TableByID, and change TableByID to skip refill infoschema v2 cache.
The observation is that: when we call TableByID, we must know the table ID ... how do we get the ID? something like TableByName may have been called, so we do not need to update cache again in TableByID because TableByName already do it.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

Verify the scanerio and check cache hit ratio.

  • 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 size/S Denotes a PR that changes 10-29 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 75.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 75.5334%. Comparing base (9fee330) to head (b9fc64f).
Report is 6 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #55101        +/-   ##
================================================
+ Coverage   74.8025%   75.5334%   +0.7309%     
================================================
  Files          1570       1576         +6     
  Lines        364715     446859     +82144     
================================================
+ Hits         272816     337528     +64712     
- Misses        72132      88473     +16341     
- Partials      19767      20858      +1091     
Flag Coverage Δ
integration 50.9204% <75.0000%> (?)
unit 71.7056% <75.0000%> (-1.9753%) ⬇️

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

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

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

Copy link
Contributor

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

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

Should we let caller decide noRefill cache? I think there are some cases that full tables load is trigger but we still need to skip refill, like keyvis queries all tables.

@tiancaiamao
Copy link
Contributor Author

Should we let caller decide noRefill cache? I think there are some cases that full tables load is trigger but we still need to skip refill, like keyvis queries all tables.

Change interface method involves much more code changes.
We need to evoluate it carefully before doing any actual actions.
Let's keep thing simple first. @lance6716

@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
Contributor

@GMHDBJD GMHDBJD left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Aug 6, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: GMHDBJD, lance6716

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 12:54:41.358673984 +0000 UTC m=+7678.577435594: ☑️ agreed by lance6716.
  • 2024-08-06 09:23:30.036166566 +0000 UTC m=+343939.903265651: ☑️ agreed by GMHDBJD.

@ti-chi-bot ti-chi-bot bot merged commit 3b19de6 into pingcap:master Aug 6, 2024
22 of 23 checks passed
@tiancaiamao tiancaiamao deleted the table-by-id branch August 6, 2024 10:54
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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants