Skip to content
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

resource_manager/client: resource group Independent reporting time #6150

Merged
merged 4 commits into from Mar 14, 2023

Conversation

CabinfeverB
Copy link
Member

@CabinfeverB CabinfeverB commented Mar 12, 2023

What problem does this PR solve?

Issue Number: Close #6151 Close #6113

What is changed and how does it work?

The following changes have been made:

  1. remove most fields inResourceGroupsController and introduce requestFailed and lastRequestTime into groupCostController .
  2. Every time the stateUpdateTicker check is triggered, all resource groups are traversed to see if they need to be reported. There are three conditions for the report: low token, RU consumption in the period exceeds the threshold, and the last request fails.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    image

image
image

Release note

None.

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Mar 12, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • JmPotato
  • nolouch

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot
Copy link
Member

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot added release-note-none do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Mar 12, 2023
@codecov
Copy link

codecov bot commented Mar 12, 2023

Codecov Report

Patch coverage: 57.50% and project coverage change: -0.05 ⚠️

Comparison is base (0b36238) 74.41% compared to head (1f0627c) 74.37%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6150      +/-   ##
==========================================
- Coverage   74.41%   74.37%   -0.05%     
==========================================
  Files         391      391              
  Lines       38175    38161      -14     
==========================================
- Hits        28409    28382      -27     
- Misses       7241     7265      +24     
+ Partials     2525     2514      -11     
Flag Coverage Δ
unittests 74.37% <57.50%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
client/resource_group/controller/config.go 100.00% <ø> (ø)
client/resource_group/controller/controller.go 61.03% <57.50%> (-3.82%) ⬇️

... and 28 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@CabinfeverB CabinfeverB requested review from nolouch and JmPotato and removed request for lhy1024 and HunDunDM March 13, 2023 02:01
@CabinfeverB CabinfeverB changed the title self report resource_manager/client: resource group Independent reporting time Mar 13, 2023
@CabinfeverB CabinfeverB marked this pull request as ready for review March 13, 2023 02:34
@ti-chi-bot ti-chi-bot removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/needs-triage-completed labels Mar 13, 2023
Copy link
Contributor

@nolouch nolouch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest lgtm

c.run.requestNeedsRetry = false
c.collectTokenBucketRequests(c.loopCtx, FromPeriodReport, false /* select all */)
if len(c.run.currentRequests) == 0 {
c.collectTokenBucketRequests(c.loopCtx, FromPeriodReport, 0 /* select resource groups which should be reported periodically */)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
c.collectTokenBucketRequests(c.loopCtx, FromPeriodReport, 0 /* select resource groups which should be reported periodically */)
c.collectTokenBucketRequests(c.loopCtx, FromPeriodReport, periodicReport /* select resource groups which should be reported periodically */)

if !c.run.requestInProgress {
c.collectTokenBucketRequests(c.loopCtx, FromLowRU, true /* only select low tokens resource group */)
if len(c.run.currentRequests) == 0 {
c.collectTokenBucketRequests(c.loopCtx, FromLowRU, 1 /* select low tokens resource group */)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
c.collectTokenBucketRequests(c.loopCtx, FromLowRU, 1 /* select low tokens resource group */)
c.collectTokenBucketRequests(c.loopCtx, FromLowRU, lowToken /* select low tokens resource group */)

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 13, 2023
@nolouch
Copy link
Contributor

nolouch commented Mar 13, 2023

ptal @JmPotato @HuSharp

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Copy link
Member

@JmPotato JmPotato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest LGTM.

@@ -88,20 +95,7 @@ type ResourceGroupsController struct {
tokenBucketUpdateChan chan *groupCostController

run struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I suggest removing the redundant field as it appears to only contain a single value?

// requestFailed is set true when sending token bucket request.
// And it is set false when reciving token bucket response.
// This triggers a retry attempt on the next tick.
requestFailed bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usage looks not very related to the "fail", requestInProgress makes more sence to me.

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 14, 2023
@JmPotato
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member

@JmPotato: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

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.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 691c2aa

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 14, 2023
@ti-chi-bot
Copy link
Member

@CabinfeverB: 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.

@ti-chi-bot ti-chi-bot merged commit 163c08c into tikv:master Mar 14, 2023
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
4 participants