-
Notifications
You must be signed in to change notification settings - Fork 719
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
*: prevent store config updating periodically #7163
Conversation
Signed-off-by: Ryan Leung <rleungx@gmail.com>
[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 Report
@@ Coverage Diff @@
## master #7163 +/- ##
==========================================
- Coverage 74.58% 74.56% -0.03%
==========================================
Files 441 441
Lines 47292 47362 +70
==========================================
+ Hits 35275 35314 +39
- Misses 8940 8955 +15
- Partials 3077 3093 +16
Flags with carried forward coverage won't be shown. Click here to find out more. |
// so we could directly save the string rule in JSON to the storage here. | ||
log.Info("update placement rule", zap.String("key", string(kv.Key)), zap.String("value", string(kv.Value))) | ||
return rw.ruleStore.SaveRule( | ||
strings.TrimPrefix(string(kv.Key), prefixToTrim), | ||
string(kv.Value), | ||
) | ||
} | ||
deleteFn := func(kv *mvccpb.KeyValue) error { | ||
log.Info("delete placement rule", zap.String("key", string(kv.Key))) |
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.
Will it print a lot of logs?
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 frequently add/remove the rule, it will, like the current status of the audit log. However, we cannot change the log level for microservices. Once it is supported, I can change it to the debug level if it's too noisy. Right now, it is more convenient for us to test.
server/cluster/cluster.go
Outdated
// Update the stores if the synchronization is not completed. | ||
if !synced { | ||
stores = c.GetStores() | ||
} else if err := c.opt.Persist(c.storage); err != nil { | ||
log.Warn("store config persisted failed", zap.Error(err)) | ||
} else if !isLastSynced && synced { |
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 seems to cause the config only to be saved once forever.
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.
Oh, nice catch, let me think about how to fix 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.
observeStoreConfig
will check if the config fetched is equal to the old one, maybe we could use that as a flag to check if the persistence is necessary.
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.
Updated. PTAL
Signed-off-by: Ryan Leung <rleungx@gmail.com>
@@ -146,6 +147,7 @@ func (cw *Watcher) initializeSchedulerConfigWatcher() error { | |||
prefixToTrim := cw.schedulerConfigPathPrefix + "/" | |||
putFn := func(kv *mvccpb.KeyValue) error { | |||
name := strings.TrimPrefix(string(kv.Key), prefixToTrim) | |||
log.Info("update scheduler config", zap.Reflect("name", string(kv.Value))) |
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 zap.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.
updated
Signed-off-by: Ryan Leung <rleungx@gmail.com>
/merge |
@rleungx: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger
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: 9baff86
|
ref tikv#5839 Signed-off-by: Ryan Leung <rleungx@gmail.com>
What problem does this PR solve?
Issue Number: Ref #5839.
What is changed and how does it work?
This PR reduces the time for unnecessary updating store config and adds more logs to help us debug the problem.
Check List
Tests
Release note