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_v2: get table cache with old schema version #51385

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

GMHDBJD
Copy link
Contributor

@GMHDBJD GMHDBJD commented Feb 28, 2024

What problem does this PR solve?

Issue Number: ref #50959

Problem Summary:

What changed and how does it work?

  • set table cache key with the old schema version instead of current schema version, therefore, we only have one table cache when schema version update(DDL not related to that table)

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
func init() {
    enableV2.Store(true)
}

Start tidb, create some tabe, insert data, drop table, verify the basic operations etc...

This commit doesn't break anyting because the new code is not used now.
We need prepare a test plan document and add tests later.

  • 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-triage-completed do-not-merge/needs-linked-issue 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 Feb 28, 2024
Copy link

tiprow bot commented Feb 28, 2024

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

codecov bot commented Feb 28, 2024

Codecov Report

Attention: Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.

Project coverage is 72.7607%. Comparing base (961159c) to head (16dbe9d).
Report is 2030 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #51385        +/-   ##
================================================
+ Coverage   70.6643%   72.7607%   +2.0964%     
================================================
  Files          1461       1461                
  Lines        434873     436202      +1329     
================================================
+ Hits         307300     317384     +10084     
+ Misses       108320      98857      -9463     
- Partials      19253      19961       +708     
Flag Coverage Δ
integration 49.0201% <0.0000%> (?)

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

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

@GMHDBJD
Copy link
Contributor Author

GMHDBJD commented Feb 28, 2024

/retest

Copy link

tiprow bot commented Feb 28, 2024

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

// Maybe the table is evicted? need to reload.
ret, err := loadTableInfo(is.r, is.Data, id, itm.dbID, is.ts, is.schemaVersion)
if err == nil {
// TODO: update schema version in BTree and Cache?
Copy link
Contributor

Choose a reason for hiding this comment

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

For the btree, we don't need to update it.
applyDiff could maintain one copy of the correct schema version if table does not change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean if we get a table at v1, after a long time, if the version increase to v100, can we update it in Btree to v100?(if the table does not change)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we can, it does not affect the correctness, but it is not always be a positive change.

Depending on our caching strategy:

  1. shall we always tend to cache the newest table for every schema change?
  2. shall we tend to lazy update the cache, i.e. cache the old table if schema change but a specific table was not touched?
  3. shall we tend to cache multiple schema version of a table, even the table meta info do not change?

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

ti-chi-bot bot commented Feb 28, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-02-28 09:12:55.592608716 +0000 UTC m=+1039664.340231855: ☑️ agreed by tiancaiamao.

Copy link

ti-chi-bot bot commented Feb 28, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tiancaiamao
Once this PR has been reviewed and has the lgtm label, please ask for approval from gmhdbjd. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@GMHDBJD GMHDBJD requested a review from tiancaiamao February 28, 2024 11:33
@GMHDBJD
Copy link
Contributor Author

GMHDBJD commented Feb 28, 2024

/retest

Copy link

tiprow bot commented Feb 28, 2024

@GMHDBJD: 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

ti-chi-bot bot commented Mar 29, 2024

PR needs rebase.

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 the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 29, 2024
Copy link

ti-chi-bot bot commented Nov 18, 2024

@GMHDBJD: 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
idc-jenkins-ci-tidb/unit-test 16dbe9d link true /test unit-test
pull-br-integration-test 16dbe9d link true /test pull-br-integration-test
pull-lightning-integration-test 16dbe9d link true /test pull-lightning-integration-test
pull-integration-e2e-test 16dbe9d link true /test pull-integration-e2e-test

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-1-more-lgtm Indicates a PR needs 1 more LGTM. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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.

2 participants