feat(dynamodb): refuse WarmThroughput above the per table quota (#9096)

CreateTable and UpdateTable now refuse a WarmThroughput above the per
table quota of 40000 units, for a table and for a global secondary
index, with the LimitExceededException AWS answers. Each member is
checked against its lower bound first, then against the quota, Read
before Write and the table before its indexes; on CreateTable the check
runs after ResourceInUseException and before the provisioned capacity
quota. The quota is the TableMaxReadCapacityUnits and
TableMaxWriteCapacityUnits that DescribeLimits reports.
This commit is contained in:
TATSUNO “Taz” Yasuhiro authored and GitHub committed 2026-11-20 14:26:16 -04:00
1 parent 6f73107fea
commit 7e2d9e83fb
2 files changed
+80 -19

No files matched your search

@@ -1138,6 +1138,51 @@ class NativeDynamoDbJsonHandlerTest {
assertEquals("ResourceInUseException", ex.getErrorCode());
}
@Test
void createTableRejectsWarmThroughputAboveThePerTableQuota() {
AwsException tableEx = warmFailure("CreateTable",
warmTableRequest("warm-quota-create", true, "{\"ReadUnitsPerSecond\": 40001}", null));
assertEquals("LimitExceededException", tableEx.getErrorCode());
assertEquals("Subscriber limit exceeded: Requested ReadUnitsPerSecond for WarmThroughput for table exceeds "
+ "TableMaxReadCapacityUnits of the account in region eu-west-1", tableEx.getMessage());
AwsException indexEx = warmFailure("CreateTable",
warmTableRequest("warm-quota-create", false, null, "{\"WriteUnitsPerSecond\": 40001}"));
assertEquals("Subscriber limit exceeded: Requested WriteUnitsPerSecond for WarmThroughput for index gsi1 "
+ "exceeds TableMaxWriteCapacityUnits of the account in region eu-west-1", indexEx.getMessage());
AwsException lowFirst = warmFailure("CreateTable", warmTableRequest("warm-quota-create", true,
"{\"ReadUnitsPerSecond\": 1, \"WriteUnitsPerSecond\": 40001}", null));
assertEquals("ValidationException", lowFirst.getErrorCode());
assertThrows(AwsException.class, () -> describedTable("warm-quota-create"));
}
@Test
void updateTableRejectsWarmThroughputAboveThePerTableQuota() throws Exception {
createWarmTable("warm-quota-update", true, null, null);
AwsException tableEx = warmFailure("UpdateTable", json("""
{"TableName": "warm-quota-update", "WarmThroughput": {"ReadUnitsPerSecond": 40001,
"WriteUnitsPerSecond": 1}}
"""));
assertEquals("Subscriber limit exceeded: Requested ReadUnitsPerSecond for WarmThroughput for table exceeds "
+ "TableMaxReadCapacityUnits of the account in region eu-west-1", tableEx.getMessage());
AwsException indexEx = warmFailure("UpdateTable", json("""
{"TableName": "warm-quota-update", "GlobalSecondaryIndexUpdates": [
{"Update": {"IndexName": "gsi1", "WarmThroughput": {"WriteUnitsPerSecond": 40001}}}]}
"""));
assertEquals("Subscriber limit exceeded: Requested WriteUnitsPerSecond for WarmThroughput for index gsi1 "
+ "exceeds TableMaxWriteCapacityUnits of the account in region eu-west-1", indexEx.getMessage());
assertWarm(warmThroughputOf(describedTable("warm-quota-update")), 12000, 4000, "ACTIVE");
updateWarm("""
{"TableName": "warm-quota-update", "WarmThroughput": {"ReadUnitsPerSecond": 40000,
"WriteUnitsPerSecond": 40000}}
""");
assertWarm(warmThroughputOf(describedTable("warm-quota-update")), 40000, 40000, "ACTIVE");
}
@Test
void updateTableRejectsEmptyTableWarmThroughputWithInternalFailure() throws Exception {
createWarmTable("warm-empty-table", true, null, null);