-
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
planner: a new thread-safe lock-free plan cache #54089
planner: a new thread-safe lock-free plan cache #54089
Conversation
Hi @qw4990. 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 #54089 +/- ##
=================================================
- Coverage 74.8567% 56.1599% -18.6968%
=================================================
Files 1516 1642 +126
Lines 360852 615583 +254731
=================================================
+ Hits 270122 345711 +75589
- Misses 71179 246554 +175375
- Partials 19551 23318 +3767
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.
thanks!
Co-authored-by: 二手掉包工程师 <[email protected]>
Co-authored-by: 二手掉包工程师 <[email protected]>
if len(lastUsedTimes) < int(numToEvict) { | ||
return |
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 could this happen?
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.
Just for safety, to avoid index-out-of-range panic below.
Co-authored-by: Zhou Kunqin <[email protected]>
Co-authored-by: Zhou Kunqin <[email protected]>
Thanks, all comments have been addressed @time-and-fate |
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.
Others LGTM.
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
package core |
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.
Need an empty line here to pass CI.
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
package core |
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.
ditto.
Evict(sctx sessionctx.Context) (evicted bool) | ||
// MemUsage returns the total memory usage of this plan cache. | ||
MemUsage(sctx sessionctx.Context) int64 |
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.
Looks like we don't need sctx
parameter for these two methods.
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.
Approve in advance.
Please address @time-and-fate's comment.
// Get gets the cached value from the cache according to key and opts. | ||
Get(sctx sessionctx.Context, key string, opts any) (value any, ok bool) | ||
// Put puts the key and value into the cache. | ||
Put(sctx sessionctx.Context, key string, value, opts any) (succ bool) |
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 we should add a comment to explain why we need to use them here. But I am fine if you prefer not to add it.
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.
Added, Thanks!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hi-rustin, time-and-fate 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 |
[LGTM Timeline notifier]Timeline:
|
What problem does this PR solve?
Issue Number: close #54057
Problem Summary: planner: a new thread-safe lock-free plan cache
What changed and how does it work?
I'll add more test cases in the next few PRs.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.