-
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: tend to cache the old key in caching strategy for infoschema v2 #54501
Conversation
Hi @tiancaiamao. 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 ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #54501 +/- ##
=================================================
- Coverage 74.8681% 56.2954% -18.5727%
=================================================
Files 1549 1665 +116
Lines 362122 604095 +241973
=================================================
+ Hits 271114 340078 +68964
- Misses 71466 240690 +169224
- Partials 19542 23327 +3785
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
LGTM
/retest-required |
@tiancaiamao: 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. |
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.
rest lgtm
pkg/infoschema/infoschema_v2.go
Outdated
@@ -444,6 +440,17 @@ func isSpecialDB(dbName string) bool { | |||
dbName == util.MetricSchemaName.L | |||
} | |||
|
|||
// EvictTable is exported for testing only. | |||
func (is *infoschemaV2) EvictTable(schema, tbl string) { |
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.
maybe implement it in test file of the same package, see
tidb/pkg/disttask/framework/scheduler/main_test.go
Lines 25 to 32 in ef0a3eb
func (sm *Manager) GetRunningTaskCnt() int { | |
return sm.getSchedulerCount() | |
} | |
// DelRunningTask implements Scheduler.DelRunningTask interface. | |
func (sm *Manager) DelRunningTask(id int64) { | |
sm.delScheduler(id) | |
} |
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.
Some other parts may also need this functionality and it's in some other packages.
https://github.com/pingcap/tidb/pull/54479/files#diff-cabf59f012600c8b513d4eb03385f48e3fdd9b8ac3f13c175133d40c9354722bR279
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: D3Hunter, GMHDBJD 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 |
/test unit-test |
@tiancaiamao: 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. |
/test mysql-test |
@tiancaiamao: 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. |
/test mysql-test |
@tiancaiamao: 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. |
/test mysql-test |
@tiancaiamao: 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. |
/ok-to-test |
Need to wait this PR to merge first #54282 |
/test mysql-test |
@tiancaiamao: The specified target(s) for
Use 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. |
/test mysql-test |
@tiancaiamao: The specified target(s) for
Use 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. |
/test check-dev2 |
@tiancaiamao: The specified target(s) for
Use 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. |
/retest |
What problem does this PR solve?
Issue Number: close #54500
ref #50959
Problem Summary:
What changed and how does it work?
The bug is caused by the old caching strategy.
When we check the schema version from the btree, we get the old cache key.
When we update the cache, we use the latest schema version as the cache key.
It means when the old cache key is evicted, we will always cache miss and the refill does not help.
In this commit, I change the caching strategy tending to cache the old schema version.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.