-
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
scheduler: extract storage operations to schedulerConfig interface #8515
Conversation
Signed-off-by: okJiang <819421878@qq.com>
Skipping CI for Draft Pull Request. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8515 +/- ##
==========================================
+ Coverage 77.40% 77.54% +0.14%
==========================================
Files 473 474 +1
Lines 61934 61864 -70
==========================================
+ Hits 47941 47975 +34
+ Misses 10409 10356 -53
+ Partials 3584 3533 -51
Flags with carried forward coverage won't be shown. Click here to find out more. |
Signed-off-by: okJiang <819421878@qq.com>
Signed-off-by: okJiang <819421878@qq.com>
/test pull-integration-realcluster-test |
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.
self review
Signed-off-by: okJiang <819421878@qq.com>
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.
Is it similar to #7598?
Signed-off-by: okJiang <819421878@qq.com>
…nify-scheduler-config
Signed-off-by: okJiang <819421878@qq.com>
@@ -120,7 +112,7 @@ func (h *splitBucketHandler) updateConfig(w http.ResponseWriter, r *http.Request | |||
} | |||
newc, _ := json.Marshal(h.conf) | |||
if !bytes.Equal(oldc, newc) { | |||
if err := h.conf.persistLocked(); err != nil { | |||
if err := h.conf.save(h.conf); err != nil { |
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 looks strange.
@@ -79,7 +79,7 @@ func (conf *balanceLeaderSchedulerConfig) update(data []byte) (int, any) { | |||
} | |||
return http.StatusBadRequest, "invalid batch size which should be an integer between 1 and 10" | |||
} | |||
if err := conf.persistLocked(); err != nil { | |||
if err := conf.save(conf); err != nil { |
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 conf.save()
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 we change it to the form of conf.save()
, then we will have to save conf
(xxxxxSchedulerConfig) as a pointer(any) in baseSchedulerConfig
. I'm not sure if this is a good idea. If everyone agrees, I can make this change.
cc @rleungx
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've made this change, we can compare them and choose the best one. 96ef87e
Actually, I also think that save()
is better👀
newCfg := &evictSlowTrendSchedulerConfig{} | ||
if err = DecodeConfig([]byte(cfgData), newCfg); err != nil { | ||
if err := s.conf.load(newCfg); err != nil { |
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 err, newCfg := s.conf.load()
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.
We need to know the structures that need to be decoded, so we have to input them in.
Signed-off-by: okJiang <819421878@qq.com>
defer handler.config.Unlock() | ||
prevRecoveryDurationGap := handler.config.RecoveryDurationGap | ||
|
||
conf := handler.config |
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.
Is the conf
assignment also need to be in the lock scope?
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.
This is a pointer, so this assignment won't trigger any data reading or writing.
But to avoid similar misunderstandings, I'll revert this change, it won't affect this pull request.
handler.config.Lock() | ||
defer handler.config.Unlock() | ||
prevRecoveryDurationGap := handler.config.RecoveryDurationGap | ||
conf := handler.config |
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.
ditto
Signed-off-by: okJiang <819421878@qq.com>
…nify-scheduler-config
Signed-off-by: okJiang <819421878@qq.com>
Signed-off-by: okJiang <819421878@qq.com>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lhy1024, niubell, rleungx 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 |
What problem does this PR solve?
Issue Number: Close #8514, ref #8379
What is changed and how does it work?
Check List
Tests
Code changes
Side effects
Related changes
Release note