[UCP] Noise reduction support when cluster auto scaling (#2307) #2568
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.
cherry-pick #2307 to release-1.1
What problem does this PR solve?
UCP #2241
What is changed and how does it work?
Add Phrase for
TidbClusterAutoScaler
, it has three optional values: Normal, ReadyToScaleOut, ReadyToScaleIn.Add user defined autoscale threshold.
use tidb as an example, tikv should be the same.
check phase
after autoscaler calculate the target replica, if target replica equals to current replica, set auto scaler phase to normal and return, otherwise check if the phase equal to scaleOut or scaleIn, if not, update the phase and record timestamp. go to 2.
check timestamp threshold
check the record timestamp remains longer than threshold which user defined. If not, return, otherwise go to 3.
do autoscale
set phase to normal and do normal autoscale.
Design for e2e tests:
After mock response from Prometheus, without noise reduction, it will start auto scaling after maximum 30s, but with noise reduction, we expect at least in 300s (ReadyToScaleThresholdSeconds),
cluster should remain the replica number. And after
ReadyToScaleThresholdSeconds
time, the cluster should start normal auto scaling and auto scale phase should be back to normal.Check List
Tests
Code changes
Side effects
n/a
Related changes
Does this PR introduce a user-facing change?: