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

mcs, client: support returning ru statistics in Get/ListResourceGroup response #7617

Merged
merged 17 commits into from
Dec 27, 2023

Conversation

glorv
Copy link
Contributor

@glorv glorv commented Dec 25, 2023

What problem does this PR solve?

Issue Number: Close #7616

What is changed and how does it work?

- persist resource group ru consumption in meta storage
- Add optional param `with_stats` to allow GetResourceGroup/ListResourceGroups return ru consumption data.

Check List

Tests

  • Unit test
  • Integration test

Code changes

Side effects

Related changes

Release note

None.

Copy link
Contributor

ti-chi-bot bot commented Dec 25, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • CabinfeverB
  • 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 ti-chi-bot bot added the release-note-none Denotes a PR that doesn't merit a release note. label Dec 25, 2023
@ti-chi-bot ti-chi-bot bot requested review from JmPotato and rleungx December 25, 2023 05:53
@ti-chi-bot ti-chi-bot bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Dec 25, 2023
@glorv
Copy link
Contributor Author

glorv commented Dec 25, 2023

/cc @nolouch @CabinfeverB @HuSharp

@CabinfeverB CabinfeverB requested review from nolouch, CabinfeverB and HuSharp and removed request for JmPotato and rleungx December 25, 2023 05:54
Signed-off-by: glorv <[email protected]>
Signed-off-by: glorv <[email protected]>
@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 25, 2023
@nolouch nolouch requested a review from bufferflies December 26, 2023 04:16

if rg.RUConsumption != nil {
consumption := *rg.RUConsumption
group.RUStats = &consumption
Copy link
Contributor

Choose a reason for hiding this comment

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

peresit consumption both in ResourceGroup.persistSettings and SaveResourceGroupStates? I think we can only persist once in GroupState.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the side effect that both grpc and persistSettings uses IntoProtoResourceGroup to serialize resource group. The RUStats in group setting is not used.

Copy link
Contributor

Choose a reason for hiding this comment

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

So is RuStats useless? can we remove it from proto.ResourceGroup?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

RuStats is used in the grpc response

@ti-chi-bot ti-chi-bot bot added the status/LGT1 Indicates that a PR has LGTM 1. label Dec 26, 2023
go.mod Outdated
gotest.tools/gotestsum v1.7.0
)

require (
google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect
Copy link
Member

Choose a reason for hiding this comment

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

need format

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@ti-chi-bot ti-chi-bot bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Dec 26, 2023
Signed-off-by: glorv <[email protected]>
}
m.RUnlock()
Copy link
Contributor

Choose a reason for hiding this comment

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

why needs to change this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The original code is incorrect and unnecessary. 1) there is possible concurrency issue between RUnlock and Lock; 2) persistStates only requires read lock, thus no need to acquire Lock here.

@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 27, 2023
@glorv
Copy link
Contributor Author

glorv commented Dec 27, 2023

/retest

Signed-off-by: glorv <[email protected]>
Signed-off-by: glorv <[email protected]>
Copy link

codecov bot commented Dec 27, 2023

Codecov Report

Merging #7617 (260570c) into master (4ed2605) will increase coverage by 0.07%.
The diff coverage is 97.91%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7617      +/-   ##
==========================================
+ Coverage   74.81%   74.88%   +0.07%     
==========================================
  Files         459      459              
  Lines       50615    50647      +32     
==========================================
+ Hits        37866    37927      +61     
+ Misses       9405     9388      -17     
+ Partials     3344     3332      -12     
Flag Coverage Δ
unittests 74.88% <97.91%> (+0.07%) ⬆️

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

@CabinfeverB
Copy link
Member

/merge

Copy link
Contributor

ti-chi-bot bot commented Dec 27, 2023

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

/run-all-tests

You only need to trigger /merge once, and 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.

If you have any questions about the PR merge process, please refer to pr process.

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.

Copy link
Contributor

ti-chi-bot bot commented Dec 27, 2023

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

Commit hash: 260570c

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label Dec 27, 2023
@ti-chi-bot ti-chi-bot bot merged commit d3551ea into tikv:master Dec 27, 2023
@glorv glorv deleted the rg-ru-stats branch December 27, 2023 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support persisting ru consumption statistics data and return ru statistics in get response
5 participants