api: support temporary configuration#3082
Merged
ti-srebot merged 12 commits intotikv:masterfrom Oct 21, 2020
Merged
Conversation
Signed-off-by: Song Gao <disxiaofei@163.com>
Contributor
Author
|
@3pointer @glorv @overvenus PTAL |
rleungx
reviewed
Oct 19, 2020
| // allows to access them safely. | ||
| type PersistOptions struct { | ||
| // configuration -> ttl value | ||
| ttl map[string]*cache.TTLString |
Contributor
Author
There was a problem hiding this comment.
As we didn't persist it, so we need lightning and BR to call this API with a short interval (like once a minute)
disksing
approved these changes
Oct 19, 2020
lhy1024
reviewed
Oct 19, 2020
server/api/config_test.go
Outdated
| c.Assert(s.svr.GetPersistOptions().GetStoreLimit(1).RemovePeer, Equals, float64(999)) | ||
| c.Assert(s.svr.GetPersistOptions().GetMaxMergeRegionSize(), Equals, uint64(999)) | ||
| c.Assert(s.svr.GetPersistOptions().GetMaxMergeRegionKeys(), Equals, uint64(999)) | ||
| time.Sleep(10 * time.Second) |
Contributor
There was a problem hiding this comment.
It will delay the test time.
server/api/config.go
Outdated
| } | ||
|
|
||
| // @Tags config | ||
| // @Summary Update temporary configuration. Note that this is a temporary api and only support for lightning and BR. Don't call this API and it will be removed in release-5.0. |
Contributor
There was a problem hiding this comment.
do we need to add a warning in the return result?
Contributor
Author
There was a problem hiding this comment.
I think the Warning in @description is enough.
overvenus
reviewed
Oct 19, 2020
server/api/config_test.go
Outdated
| "store-limit-add-peer": 999, | ||
| "max-merge-region-size": 999, | ||
| "max-merge-region-keys": 999, | ||
| "store-limit-remove-peer": 999, |
Member
There was a problem hiding this comment.
BR needs enable-location-replacement too.
Signed-off-by: Song Gao <disxiaofei@163.com>
Signed-off-by: Song Gao <disxiaofei@163.com>
Signed-off-by: Song Gao <disxiaofei@163.com>
nolouch
reviewed
Oct 20, 2020
server/api/router.go
Outdated
| apiRouter.HandleFunc("/config/cluster-version", confHandler.SetClusterVersion).Methods("POST") | ||
| apiRouter.HandleFunc("/config/replication-mode", confHandler.GetReplicationMode).Methods("GET") | ||
| apiRouter.HandleFunc("/config/replication-mode", confHandler.SetReplicationMode).Methods("POST") | ||
| apiRouter.HandleFunc("/config/ttl", confHandler.SetTTLConfig).Methods("POST") |
Contributor
There was a problem hiding this comment.
why not consist with store api, use /config?ttlSecond=xx?
| } | ||
|
|
||
| var ttl int | ||
| if ttlSec := r.URL.Query().Get("ttlSecond"); ttlSec != "" { |
Signed-off-by: Song Gao <disxiaofei@163.com>
Signed-off-by: Song Gao <disxiaofei@163.com>
Contributor
|
LGTM |
ti-srebot
approved these changes
Oct 21, 2020
Contributor
Author
|
/merge |
Contributor
|
/run-all-tests |
ti-srebot
pushed a commit
to ti-srebot/pd
that referenced
this pull request
Oct 21, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
Contributor
|
cherry pick to release-4.0 in PR #3088 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
What is changed and how it works?
Provide a temporary API to support temporary configuration for some configurations.
Make
/store/{id}/limitand/stores/limitsupport ttl param.Note that this API is only supported for lightning and BR as a temporary way. Don't call this API.
As the temporary configuration only is saved in the memory, a recommended way to use API is calling it with short interval (once a minute) and long ttl (10 minutes).
Release note