mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
fix(studio): use configured gp3 max-throughput ceiling (#50355)
`calculateMaxThroughput` still hard-capped at 1000 MB/s while `DISK_LIMITS.gp3.maxThroughput` moved to 2000, so large gp3 disks were rejected with a misleading "Need at least N IOPS to support X MB/s" error even when IOPS and compute were already sufficient. Now reads the configured ceiling, mirroring the IOPS fix in #50269 that missed this sibling. Fixes FE-4385 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - GP3 storage configurations can now support throughput scaling up to 2,000 MB/s when sufficient compute capacity is available. - Larger GP3 configurations, including up to 4,096 GB with 80,000 IOPS and 2,000 MB/s throughput, are now recognized as valid when capacity requirements are met. - **Bug Fixes** - Corrected the maximum GP3 throughput calculation to honor the supported service limit. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
1 parent
608c3a0813
commit
56820eb048
2 files changed
+33
-1
No files matched your search
@@ -8,6 +8,7 @@ import {
|
||||
calculateIOPSPrice,
|
||||
calculateMaxIopsAllowedForDiskSizeWithGp3,
|
||||
calculateMaxIopsForComputeSize,
|
||||
calculateMaxThroughput,
|
||||
calculateThroughputPrice,
|
||||
mapAddOnVariantIdToComputeSize,
|
||||
mapComputeSizeNameToAddonVariantId,
|
||||
@@ -84,6 +85,18 @@ describe('calculateMaxIopsAllowedForDiskSizeWithGp3', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('calculateMaxThroughput', () => {
|
||||
// Regression: the ceiling was hardcoded to 1000 MB/s while DISK_LIMITS.gp3.maxThroughput moved
|
||||
// to 2000, so large gp3 disks were rejected with a misleading "need more IOPS" error.
|
||||
test('scales with provisioned IOPS below the gp3 max throughput ceiling', () => {
|
||||
expect(calculateMaxThroughput(4000)).toBe(1024)
|
||||
})
|
||||
|
||||
test('caps at the gp3 max throughput ceiling (2000 MB/s)', () => {
|
||||
expect(calculateMaxThroughput(80000)).toBe(2000)
|
||||
})
|
||||
})
|
||||
|
||||
describe('DiskManagement.utils.ts:calculateDiskSizePrice', () => {
|
||||
test('GP3 with 8GB to GP3 with 10GB for pro plan', () => {
|
||||
const result = calculateDiskSizePrice({
|
||||
@@ -233,6 +246,24 @@ describe('CreateDiskStorageSchema', () => {
|
||||
)
|
||||
})
|
||||
|
||||
test('allows gp3 throughput above 1000 MB/s when IOPS and compute support it', () => {
|
||||
const schema = CreateDiskStorageSchema({
|
||||
defaultTotalSize: 4096,
|
||||
cloudProvider: 'AWS',
|
||||
isSpendCapEnabled: false,
|
||||
})
|
||||
|
||||
const result = schema.safeParse({
|
||||
...validGp3Config,
|
||||
totalSize: 4096,
|
||||
provisionedIOPS: 80000,
|
||||
throughput: 2000,
|
||||
computeSize: 'ci_16xlarge' as const,
|
||||
})
|
||||
|
||||
expect(result.error?.issues ?? []).toEqual([])
|
||||
})
|
||||
|
||||
test('allows a legacy disk below 8 GB when its size is unchanged', () => {
|
||||
const schema = CreateDiskStorageSchema({
|
||||
defaultTotalSize: 2,
|
||||
|
||||
@@ -298,8 +298,9 @@ export const calculateDiskSizeRequiredForIopsWithIo2 = (iops: number) => {
|
||||
return Math.max(4, Math.ceil(iops / 1000))
|
||||
}
|
||||
|
||||
const MAX_GP3_THROUGHPUT = DISK_LIMITS[DiskType.GP3]['maxThroughput']
|
||||
export const calculateMaxThroughput = (iops: number) => {
|
||||
return Math.min(0.256 * iops, 1000)
|
||||
return Math.min(0.256 * iops, MAX_GP3_THROUGHPUT)
|
||||
}
|
||||
|
||||
export const calculateIopsRequiredForThroughput = (throughput: number) => {
|
||||
|
||||
Reference in new issue
Block a user