-
Notifications
You must be signed in to change notification settings - Fork 727
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
*: decouple the dependency between config and schedule #5792
Conversation
[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. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #5792 +/- ##
==========================================
- Coverage 74.10% 73.99% -0.12%
==========================================
Files 381 383 +2
Lines 37809 37808 -1
==========================================
- Hits 28020 27975 -45
- Misses 7335 7365 +30
- Partials 2454 2468 +14
Flags with carried forward coverage won't be shown. Click here to find out more.
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 at Codecov. |
} | ||
|
||
// Config is the interface that wraps the Config related method. | ||
type Config interface { |
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.
Each scheduler also has it's own config, How to distinguish them?
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.
A config instance that implements these interfaces can be used to start the scheduling services. And this interface is used for compatibility. As for the scheduler config, it doesn't rely on the server package so it can be defined without implementing this interface.
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.
maybe we can reduce the functions.
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.
lgtm
} | ||
|
||
// Config is the interface that wraps the Config related method. | ||
type Config interface { |
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.
maybe we can reduce the functions.
@@ -995,11 +995,6 @@ func (c *ScheduleConfig) Validate() error { | |||
if c.LeaderSchedulePolicy != "count" && c.LeaderSchedulePolicy != "size" { | |||
return errors.Errorf("leader-schedule-policy %v is invalid", c.LeaderSchedulePolicy) | |||
} | |||
for _, scheduleConfig := range c.Schedulers { |
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 removed?
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.
Yes.
91fa22c
to
91e9dcf
Compare
@@ -32,6 +32,7 @@ import ( | |||
"github.com/tikv/pd/server/config" | |||
"github.com/tikv/pd/server/core" | |||
"github.com/tikv/pd/server/core/storelimit" | |||
sc "github.com/tikv/pd/server/schedule/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.
Do we favor short name over a full name? 'sc' could be read as store config? "scheduleConfig" seems to be a clearer name to me.
@@ -219,6 +233,14 @@ func (m *StoreConfigManager) GetStoreConfig() *StoreConfig { | |||
return config.(*StoreConfig) | |||
} | |||
|
|||
// SetStoreConfig sets the store configuration. | |||
func (m *StoreConfigManager) SetStoreConfig(cfg *StoreConfig) { | |||
if m == 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.
if m != nil {
m.config.Store(cfg)
}
@@ -120,6 +120,14 @@ func (c *StoreConfig) IsEnableRegionBucket() bool { | |||
return c.Coprocessor.EnableRegionBucket | |||
} | |||
|
|||
// SetRegionBucketEnabled sets if the region bucket is enabled. | |||
func (c *StoreConfig) SetRegionBucketEnabled(enabled bool) { | |||
if c == 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.
if c != nil {
c.Coprocessor.EnableRegionBucket = enabled
}
var schedulerMap sync.Map | ||
|
||
// RegisterScheduler registers the scheduler type. | ||
func RegisterScheduler(typ string) { |
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.
'type' is a reserved keyword, but I'm wondering if we can use a better name than 'typ'? how about schedulerType?
} | ||
|
||
// Config is the interface that wraps the Config related methods. | ||
type Config interface { |
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 feel this part is hard to maintain and is error-prone in the future. Just wondering if we can reuse ScheduleConfig in server/config/config.go and move it to server/scheduler to remove dependency. It seems that we want to remove the dependency (on server/config) from server/scheduler, but I'm sure if we can let server/config depend on server/scheduler/config. I mightn't fully understand our work here. I'll sync with you two after holiday. @rleungx @nolouch ^
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.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.
LGTM
@binshi-bing: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments. In response to this:
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. |
/run-all-tests |
/merge |
@rleungx: 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: 4509a2c
|
@rleungx: 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. |
What problem does this PR solve?
Issue Number: Ref #5838.
What is changed and how does it work?
Check List
Tests
Release note