-
Notifications
You must be signed in to change notification settings - Fork 721
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
[cherry-pick 6327] server: add accelerate-schedule/batch api #6348
[cherry-pick 6327] server: add accelerate-schedule/batch api #6348
Conversation
Signed-off-by: Lloyd-Pottiger <yan1579196623@gmail.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Hi @Lloyd-Pottiger. Thanks for your PR. I'm waiting for a tikv member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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 kubernetes/test-infra repository. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## release-6.5 #6348 +/- ##
===============================================
+ Coverage 75.65% 75.67% +0.02%
===============================================
Files 330 330
Lines 32975 33009 +34
===============================================
+ Hits 24946 24980 +34
+ Misses 5881 5876 -5
- Partials 2148 2153 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 23 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. |
// @Success 200 {string} string "Accelerate regions scheduling in given ranges [startKey1, endKey1), [startKey2, endKey2), ..." | ||
// @Failure 400 {string} string "The input is invalid." | ||
// @Router /regions/accelerate-schedule/batch [post] | ||
func (h *regionsHandler) AccelerateRegionsScheduleInRanges(w http.ResponseWriter, r *http.Request) { |
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.
how about exract the same code as function from AccelerateRegionsScheduleInRange
?
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.
AccelerateRegionsScheduleInRange
is not used anymore, maybe we can remove it later.
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.
I think the old api can't be remove, you don't know the other compoment has depends on it .
server/api/region.go
Outdated
var msgBuilder strings.Builder | ||
msgBuilder.Grow(128) | ||
msgBuilder.WriteString("Accelerate regions scheduling in given ranges: ") | ||
var regions []*core.RegionInfo |
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 not use regionsIDList?
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.
fix
server/api/region.go
Outdated
h.rd.JSON(w, http.StatusBadRequest, err.Error()) | ||
return | ||
} | ||
regions = append(regions, rc.ScanRegions(startKey, endKey, limit)...) |
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.
what's happened if the regions exist this new region?
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.
not possible, this api is used by partition table, the regions come from different partition tables.
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.
but this api has been expose by all people. unless you can ensure only the partition table
use 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.
It is only used by partition table now.
To avoid this, change to use set
.
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 my mistake, not need to use set, cache TTL is map
Lines 65 to 68 in 5bdfa71
c.items[key] = ttlCacheItem{ | |
value: value, | |
expire: time.Now().Add(ttl), | |
} |
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.
reverted
Signed-off-by: Lloyd-Pottiger <yan1579196623@gmail.com>
4ba5c21
to
154d785
Compare
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 reset LGTM
/ok-to-test |
/merge |
@lhy1024: 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. |
This pull request has been accepted and is ready to merge. Commit hash: 154d785
|
Thank you for working on PD! Please read PD's CONTRIBUTING document BEFORE filing this PR.
PR Title Format:
-->
What problem does this PR solve?
Issue Number: Close #6326
What is changed and how does it work?
Check List
Tests
Code changes
Side effects
Related changes
pingcap/docs
/pingcap/docs-cn
:pingcap/tiup
:Release note