mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
fix(rds): require headroom for enabled storage autoscaling (#5863)
* fix(rds): require headroom for enabled storage autoscaling * fix(rds): retain autoscaling headroom during storage growth * fix(rds): check thresholds against current storage
This commit is contained in:
1 parent
5370920012
commit
043b919e85
4 files changed
+355
No files matched your search
@@ -3074,6 +3074,7 @@ public class RdsService implements Resettable, ResourceProvider {
|
||||
// current size and engine version: a refusal here must leave the whole request unapplied.
|
||||
DbInstanceScalingChanges resolvedScaling = scaling.resolveFor(instance);
|
||||
DbInstanceSettings effective = withEffectiveWindows(settings, instance);
|
||||
validateAutoscalingMinimum(instance, effective.maxAllocatedStorage());
|
||||
instance.setStatus(DbInstanceStatus.AVAILABLE);
|
||||
if (optionGroupName != null && !optionGroupName.isBlank()) {
|
||||
validateInstanceOptionGroup(optionGroupName,
|
||||
@@ -3146,6 +3147,22 @@ public class RdsService implements Resettable, ResourceProvider {
|
||||
settings.validate();
|
||||
}
|
||||
|
||||
private static void validateAutoscalingMinimum(DbInstance instance, Integer maximum) {
|
||||
String clusterId = instance.getDbClusterIdentifier();
|
||||
String engine = engineName(instance);
|
||||
int allocated = instance.getAllocatedStorage();
|
||||
if (maximum == null || allocated <= 0 || maximum == allocated
|
||||
|| clusterId != null && !clusterId.isBlank()
|
||||
|| isAuroraEngine(engine)
|
||||
|| engine != null && engine.toLowerCase(Locale.ROOT).startsWith("custom-")) {
|
||||
return;
|
||||
}
|
||||
if ((long) maximum * 10 < (long) allocated * 11) {
|
||||
throw new AwsException("InvalidParameterCombination",
|
||||
"Invalid max storage size for " + (engine == null ? null : engine.toLowerCase(Locale.ROOT)), 400);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* AWS's conditional default for {@code PubliclyAccessible} when {@code CreateDBInstance}
|
||||
* omits it: with no subnet group given, Aurora engines default to not-publicly-accessible and
|
||||
|
||||
Reference in new issue
Block a user