-
Notifications
You must be signed in to change notification settings - Fork 720
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
checker: use ttl cache #8505
checker: use ttl cache #8505
Conversation
Signed-off-by: Ryan Leung <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8505 +/- ##
==========================================
+ Coverage 77.34% 77.43% +0.08%
==========================================
Files 472 472
Lines 61796 61795 -1
==========================================
+ Hits 47799 47850 +51
+ Misses 10433 10371 -62
- Partials 3564 3574 +10
Flags with carried forward coverage won't be shown. Click here to find out more. |
@@ -88,7 +88,7 @@ type Controller struct { | |||
|
|||
// NewController create a new Controller. | |||
func NewController(ctx context.Context, cluster sche.CheckerCluster, conf config.CheckerConfigProvider, ruleManager *placement.RuleManager, labeler *labeler.RegionLabeler, opController *operator.Controller) *Controller { | |||
pendingProcessedRegions := cache.NewDefaultCache(DefaultPendingRegionCacheSize) | |||
pendingProcessedRegions := cache.NewIDTTL(ctx, time.Minute, 3*time.Minute) |
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.
sure, previous suspectRegions
is *cache.TTLUint64
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.
Do we need to add a test for this issue?
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.
It's not just the problem of suspectRegions. The waiting list also has the same problem previously.
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.
ok, then do we need to add a test for this issue?
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.
why 3 mins?
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.
The original setting is 3 min.
} | ||
|
||
// AddPendingProcessedRegions adds the pending processed region into the cache. | ||
func (c *Controller) AddPendingProcessedRegions(ids ...uint64) { | ||
for _, id := range ids { | ||
if c.pendingProcessedRegions.Len() > DefaultPendingRegionCacheSize { |
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.
why 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.
To prevent the cache from becoming too large.
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.
If so, some regions, such as those from checkSuspectRanges
or AccelerateRegionsScheduleInRange
, may not be put successfully.
Should we only skip adding to pendingProcessedRegions
in tryAddOperators
when pendingProcessedRegions
is full?
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.
done
Signed-off-by: Ryan Leung <[email protected]>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: HuSharp, lhy1024 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 |
@rleungx: Your PR was out of date, I have automatically updated it for you. If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. 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 ti-community-infra/tichi repository. |
What problem does this PR solve?
Issue Number: Close #8500
What is changed and how does it work?
Check List
Tests
Release note