-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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: fix issue of information schema cache miss cause by schema version gap #53445
infoschema: fix issue of information schema cache miss cause by schema version gap #53445
Conversation
…a version gap Signed-off-by: crazycs520 <crazycs520@gmail.com>
Skipping CI for Draft Pull Request. |
Hi @crazycs520. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with 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. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #53445 +/- ##
================================================
+ Coverage 72.5441% 75.0142% +2.4700%
================================================
Files 1505 1505
Lines 429846 432958 +3112
================================================
+ Hits 311828 324780 +12952
+ Misses 98749 88376 -10373
- Partials 19269 19802 +533
Flags with carried forward coverage won't be shown. Click here to find out more.
|
versions = append(versions, ver) | ||
} | ||
sort.Slice(versions, func(i, j int) bool { return versions[i] < versions[j] }) | ||
for _, ver := range versions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is removing one version enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because empty schema version rarely appears, I think it's okay to delete just one here.
…-schema-cahce-hole
Signed-off-by: crazycs520 <crazycs520@gmail.com>
/retest-required |
@crazycs520: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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. |
|
||
h.emptySchemaVersions[version] = struct{}{} | ||
if len(h.emptySchemaVersions) > cap(h.cache) { | ||
// remove oldest version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without statistics of how those version are accessed, remove oldest is no better than remove random version, and more complex
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For stale-read query workload, it will always need recent schema version, so remove the oldest version is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about insert a clone of previous infoschema for the empty schema diff? with its schema version = previous schema version + 1
The data structure and all the other operations can be the same as before.
[LGTM Timeline notifier]Timeline:
|
Nice catch, I try to use methold, but this will need to introduce another TiKV RPC to get the schemaTS of the empty schema version. |
/retest-required |
…a version gap (pingcap#53445) close pingcap#53428 Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created to branch |
In response to a cherrypick label: new pull request created to branch |
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created to branch |
This reverts commit 0771279.
…a version gap (pingcap#53445) close pingcap#53428
…a version gap (pingcap#53445) close pingcap#53428 Signed-off-by: crazycs520 <crazycs520@gmail.com>
This reverts commit 2653442.
…a version gap (pingcap#53445) close pingcap#53428 Signed-off-by: crazycs520 <crazycs520@gmail.com>
…a version gap (pingcap#53445) (pingcap#53583) (pingcap#97) close pingcap#53428 Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
What problem does this PR solve?
Issue Number: close #53428
Problem Summary: fix issue of information schema cache miss cause by schema version gap
What changed and how does it work?
before this PR
When DDL has empty schema version, will cause cache miss, then stale-read query need to load snapshot schema from TiKV.
This PR
When DDL has empty schema version, this PR won't have schema cache miss, then won't cause many load snapshot schema operation.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.