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

*: support building infoschema V2, and introduce @@tidb_schema_cache_size #51257

Merged
merged 26 commits into from
Feb 29, 2024

Conversation

tiancaiamao
Copy link
Contributor

@tiancaiamao tiancaiamao commented Feb 22, 2024

What problem does this PR solve?

Issue Number: close #51256
ref #50959

!!! Need to merge #51058 first before reviewing this PR. (DONE)

Problem Summary:

What changed and how does it work?

  1. The infoschema.Builder now support building both infoschema v1 and v2

Before this change, when infoschema Builder builds the infoschema v2, it depends on building the infoschema v1 object
and rely on an infoschemaProxy object to pretender to be an InfoSchema instance.
Now it support build and use infoschemaV2 object directly.

  1. Introduce the @@tidb_schema_cache_size global session variable

The variable work as a switch for us to enable v2 if it's value is not equal to 0.
We can now change to infoschema v2 and change back to v1, it make the testing easier.

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

Caution: if we expose this global variable, but infoschema v2 implementation has not finish yet, modify the default value would be buggy. There are two options:

    1. hide it totally from the document, so nobody would know and modifty it.
    1. add this change to the document, but mark as expiremental and notify the consequence explicitly.

I would prefer 1 because it's still at an early stage for infoschema v2.

  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

Introduce `@@tidb_schema_cache_size` global session variable, infoschema V2 implementation would be used when its value is not zero

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/needs-triage-completed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 22, 2024
@tiancaiamao tiancaiamao requested a review from bb7133 February 22, 2024 11:56
Copy link

tiprow bot commented Feb 22, 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/test-infra repository.

Copy link

codecov bot commented Feb 22, 2024

Codecov Report

Merging #51257 (eb277e9) into master (44b1598) will increase coverage by 2.1547%.
Report is 1 commits behind head on master.
The diff coverage is 97.9452%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #51257        +/-   ##
================================================
+ Coverage   70.6356%   72.7904%   +2.1547%     
================================================
  Files          1462       1462                
  Lines        435011     435137       +126     
================================================
+ Hits         307273     316738      +9465     
+ Misses       108424      98464      -9960     
- Partials      19314      19935       +621     
Flag Coverage Δ
integration 49.0278% <73.2876%> (?)
unit 70.4249% <97.9452%> (+0.0055%) ⬆️

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

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

@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed do-not-merge/needs-triage-completed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 23, 2024
@tiancaiamao tiancaiamao changed the title *: support building infoschema V2, and introduce @@tidb_enable_infoschema_v2 *: support building infoschema V2, and introduce @@tidb_infoschema_cache_size Feb 28, 2024
@tiancaiamao
Copy link
Contributor Author

/retest-required

Copy link

tiprow bot commented Feb 28, 2024

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

In response to this:

/retest-required

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.

@@ -946,6 +946,9 @@ const (

// TiDBTxnEntrySizeLimit indicates the max size of a entry in membuf.
TiDBTxnEntrySizeLimit = "tidb_txn_entry_size_limit"

// TiDBInfoSchemaCacheSize indicates the size of infoschema meta data which are cached in V2 implementation.
TiDBInfoSchemaCacheSize = "tidb_infoschema_cache_size"
Copy link
Contributor

Choose a reason for hiding this comment

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

When modify the variable, should we force trigger reload infoschema?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we can, but it seems we need to register callback function in SetGlobal to call the function in domain.
How to do that is a bit complex, considering infoschema reload is called eventually anyway, I skip the force trigger part.

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Feb 29, 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

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

ti-chi-bot bot commented Feb 29, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-02-29 03:30:58.556020368 +0000 UTC m=+1105547.303643479: ☑️ agreed by ywqzzy.
  • 2024-02-29 07:14:34.059950577 +0000 UTC m=+1118962.807573688: ☑️ agreed by GMHDBJD.

@tiancaiamao tiancaiamao changed the title *: support building infoschema V2, and introduce @@tidb_infoschema_cache_size *: support building infoschema V2, and introduce @@tidb_schema_cache_size Feb 29, 2024
@easonn7
Copy link

easonn7 commented Feb 29, 2024

/approve

Copy link

ti-chi-bot bot commented Feb 29, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: easonn7, GMHDBJD, ywqzzy

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 Feb 29, 2024
@ti-chi-bot ti-chi-bot bot merged commit 0e8533c into pingcap:master Feb 29, 2024
19 of 21 checks passed
@tiancaiamao tiancaiamao deleted the builder branch February 29, 2024 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

introduce @@tidb_infoschema_cache_size switch to control the behaviour
4 participants