From 56820eb048c26e55545a47bced68ff95b6624e53 Mon Sep 17 00:00:00 2001 From: Ali Waseem Date: Tue, 15 Sep 2026 03:00:10 -0600 Subject: [PATCH] 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 ## 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. --- .../DiskManagement/DiskManagement.test.ts | 31 +++++++++++++++++++ .../DiskManagement/DiskManagement.utils.ts | 3 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/apps/studio/components/interfaces/DiskManagement/DiskManagement.test.ts b/apps/studio/components/interfaces/DiskManagement/DiskManagement.test.ts index fb15264e46a..360a08c07ca 100644 --- a/apps/studio/components/interfaces/DiskManagement/DiskManagement.test.ts +++ b/apps/studio/components/interfaces/DiskManagement/DiskManagement.test.ts @@ -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, diff --git a/apps/studio/components/interfaces/DiskManagement/DiskManagement.utils.ts b/apps/studio/components/interfaces/DiskManagement/DiskManagement.utils.ts index 4954df5030c..ef2cfe64285 100644 --- a/apps/studio/components/interfaces/DiskManagement/DiskManagement.utils.ts +++ b/apps/studio/components/interfaces/DiskManagement/DiskManagement.utils.ts @@ -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) => {