-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
statistics: add a thread-safe heap #55064
Conversation
8921722
to
bb9ffb3
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #55064 +/- ##
================================================
+ Coverage 72.7121% 75.2952% +2.5831%
================================================
Files 1561 1563 +2
Lines 438708 445591 +6883
================================================
+ Hits 318994 335509 +16515
+ Misses 100007 89896 -10111
- Partials 19707 20186 +479
Flags with carried forward coverage won't be shown. Click here to find out more.
|
5843086
to
d45bdde
Compare
299d47f
to
385d483
Compare
@@ -0,0 +1,306 @@ | |||
// Copyright 2017 The Kubernetes Authors. | |||
// Copyright 2024 PingCAP, Inc. |
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.
Better to add some comments to explain why we copy this implementation instead of using other third-party libs.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AilinKid, qw4990 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 |
What problem does this PR solve?
Issue Number: ref #55063
Problem Summary:
What changed and how does it work?
This PR added a thread-safe heap for the priority queue.
Because it doesn't involve any business logic to the priority queue, it is a pure data structure, so I think we can add it in advance.
Maybe you will ask why we don't use Fibonacci heap here. The constants for Fibonacci heaps are actually quite large, and their complexity is amortized. Therefore, it is very likely that their performance will be similar to that of regular binary heaps in this scenario.
The original implementation:
https://github.com/kubernetes/client-go/blob/master/tools/cache/heap.go
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.