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

Support to set store limit in auto or manual mode #1887

Merged
merged 9 commits into from
Dec 5, 2019

Conversation

shafreeck
Copy link
Contributor

@shafreeck shafreeck commented Nov 4, 2019

What problem does this PR solve?

Support to set store limit in auto or manual mode, it is useful when we introduce the feature to tune store limits automatically.

What is changed and how it works?

  • Add two mode for setting limit: auto or manual, an auto-set value can be overwritten by a manual-set value, otherwise it is forbidden.
  • Wrap the store limit in the StoreLimit struct
  • Extract the store limit related code into a separate file

Check List

Tests

  • Unit test

Code changes

  • Has HTTP API interfaces change

Related changes

  • Need to update the documentation
  • Need to be included in the release notes

@shafreeck shafreeck added type/enhancement The issue or PR belongs to an enhancement. DNM labels Nov 4, 2019
@shafreeck shafreeck self-assigned this Nov 4, 2019
@shafreeck shafreeck changed the title WIP: Support to set store limit in auto or manual mode Support to set store limit in auto or manual mode Nov 6, 2019
@shafreeck shafreeck removed the DNM label Nov 6, 2019
@codecov-io
Copy link

codecov-io commented Nov 6, 2019

Codecov Report

Merging #1887 into master will decrease coverage by 0.03%.
The diff coverage is 93.87%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1887      +/-   ##
==========================================
- Coverage   77.43%   77.39%   -0.04%     
==========================================
  Files         177      178       +1     
  Lines       18120    18142      +22     
==========================================
+ Hits        14031    14041      +10     
- Misses       3006     3016      +10     
- Partials     1083     1085       +2
Impacted Files Coverage Δ
server/schedule/operator_controller.go 83.57% <100%> (-0.12%) ⬇️
server/handler.go 52.35% <100%> (-0.48%) ⬇️
server/api/store.go 66.8% <100%> (+0.4%) ⬆️
server/schedule/store_limit.go 86.95% <86.95%> (ø)
pkg/testutil/operator_check.go 88.88% <0%> (-11.12%) ⬇️
pkg/metricutil/metricutil.go 90.62% <0%> (-9.38%) ⬇️
server/schedulers/hot_region.go 87.08% <0%> (-1.66%) ⬇️
server/tso/tso.go 78.83% <0%> (-1.46%) ⬇️
server/server.go 82.51% <0%> (-0.99%) ⬇️
server/config/option.go 90.32% <0%> (-0.93%) ⬇️
... and 14 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 035f65e...71ea54d. Read the comment docs.

Copy link
Contributor

@lhy1024 lhy1024 left a comment

Choose a reason for hiding this comment

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

LGTM. But why do we need to set different mode?

Signed-off-by: Shafreeck Sea <shafreeck@gmail.com>
The store limit is wrapped by a struct called StoreLimit,
it exports the useful api of the ratelimit.Bucket. It records
the limit's setting mode which can be "auto" or "manual". An "manual"
set value can overwrite an "auto set value, otherwise it is forbidden.

Signed-off-by: Shafreeck Sea <shafreeck@gmail.com>
Signed-off-by: Shafreeck Sea <shafreeck@gmail.com>
Signed-off-by: Shafreeck Sea <shafreeck@gmail.com>
Signed-off-by: Shafreeck Sea <shafreeck@gmail.com>
Signed-off-by: Shafreeck Sea <shafreeck@gmail.com>
Signed-off-by: Shafreeck Sea <shafreeck@gmail.com>
@shafreeck
Copy link
Contributor Author

shafreeck commented Nov 20, 2019

LGTM. But why do we need to set different mode?

@lhy1024 The store limit value set by PD maybe not the desired value wanted by the user in which case the user prefers to overwrite the value manually. A value set by the user should not be overwritten by PD.

@shafreeck
Copy link
Contributor Author

@lhy1024 @rleungx PTAL

Copy link
Contributor

@lhy1024 lhy1024 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

server/handler.go Outdated Show resolved Hide resolved
server/schedule/store_limit.go Show resolved Hide resolved
server/schedule/store_limit.go Show resolved Hide resolved
server/schedule/operator_controller.go Show resolved Hide resolved
Copy link
Member

@rleungx rleungx 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

Copy link
Contributor

@lhy1024 lhy1024 left a comment

Choose a reason for hiding this comment

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

LGTM

@shafreeck
Copy link
Contributor Author

@rleungx Would you mind to approve this PR if there are no more questions?

@shafreeck shafreeck added the status/can-merge Indicates a PR has been approved by a committer. label Dec 4, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Dec 4, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Dec 4, 2019

@shafreeck merge failed.

@nolouch
Copy link
Contributor

nolouch commented Dec 5, 2019

ci failed @shafreeck

@shafreeck shafreeck merged commit d11bff1 into tikv:master Dec 5, 2019
@nolouch nolouch added this to the v4.0.0-beta milestone Jan 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/can-merge Indicates a PR has been approved by a committer. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants