Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/adapter/src/catalog/builtin_table_updates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2013,13 +2013,14 @@ impl CatalogState {
continue;
}

// Just invent something when the limits are `None`, which only happens in non-prod
// environments (tests, process orchestrator, etc.)
// Limits can be `None`, specifying that resource usage is unlimited. Unfortunately,
// the relevant table fields are not nullable, so we have to put in some value. We put
// in the maximum (based on `u64::MAX`), which makes it at least immediately clear that
// the limit is a bogus one.
let cpu_limit = alloc.cpu_limit.unwrap_or(CpuLimit::MAX);
let MemoryLimit(ByteSize(memory_bytes)) =
(alloc.memory_limit).unwrap_or(MemoryLimit::MAX);
let DiskLimit(ByteSize(disk_bytes)) =
(alloc.disk_limit).unwrap_or(DiskLimit::ARBITRARY);
alloc.memory_limit.unwrap_or(MemoryLimit::MAX);
let DiskLimit(ByteSize(disk_bytes)) = alloc.disk_limit.unwrap_or(DiskLimit::MAX);

let row = Row::pack_slice(&[
size.as_str().into(),
Expand Down
42 changes: 29 additions & 13 deletions test/sqllogictest/cluster.slt
Original file line number Diff line number Diff line change
Expand Up @@ -659,19 +659,35 @@ CREATE CLUSTER REPLICA quickstart.replica AVAILABILITY ZONE 'a', STORAGECTL ADDR
# Test that the contents of mz_cluster_replicas look sensible

statement ok
CREATE CLUSTER foo REPLICAS (size_1 (SIZE 'scale=1,workers=1'), size_32 (SIZE 'scale=1,workers=32'), size_2_2 (SIZE 'scale=2,workers=2'), size_1_8g (SIZE 'scale=1,workers=1,mem=8GiB'))

query TTTTTTT
SELECT r.name, r.size, s.processes, s.cpu_nano_cores, s.memory_bytes, s.workers, s.credits_per_hour FROM mz_cluster_replicas r JOIN mz_catalog.mz_cluster_replica_sizes s ON r.size = s.size ORDER BY r.name
----
r1 scale=1,workers=2 1 18446744073709000000 18446744073709551615 2 1
r1 scale=1,workers=2 1 18446744073709000000 18446744073709551615 2 1
r1 scale=1,workers=2 1 18446744073709000000 18446744073709551615 2 1
r1 scale=1,workers=2 1 18446744073709000000 18446744073709551615 2 1
size_1 scale=1,workers=1 1 18446744073709000000 18446744073709551615 1 1
size_1_8g scale=1,workers=1,mem=8GiB 1 18446744073709000000 8589934592 1 1
size_2_2 scale=2,workers=2 2 18446744073709000000 18446744073709551615 2 2
size_32 scale=1,workers=32 1 18446744073709000000 18446744073709551615 32 1
CREATE CLUSTER foo REPLICAS (
size_1 (SIZE 'scale=1,workers=1'),
size_32 (SIZE 'scale=1,workers=32'),
size_2_2 (SIZE 'scale=2,workers=2'),
size_1_8g (SIZE 'scale=1,workers=1,mem=8GiB')
)

query TTTTTTTT
SELECT
r.name,
r.size,
s.processes,
s.cpu_nano_cores,
s.memory_bytes,
s.disk_bytes,
s.workers,
s.credits_per_hour
FROM mz_cluster_replicas r
JOIN mz_catalog.mz_cluster_replica_sizes s ON r.size = s.size
ORDER BY r.name
----
r1 scale=1,workers=2 1 18446744073709000000 18446744073709551615 18446744073709551615 2 1
r1 scale=1,workers=2 1 18446744073709000000 18446744073709551615 18446744073709551615 2 1
r1 scale=1,workers=2 1 18446744073709000000 18446744073709551615 18446744073709551615 2 1
r1 scale=1,workers=2 1 18446744073709000000 18446744073709551615 18446744073709551615 2 1
size_1 scale=1,workers=1 1 18446744073709000000 18446744073709551615 18446744073709551615 1 1
size_1_8g scale=1,workers=1,mem=8GiB 1 18446744073709000000 8589934592 18446744073709551615 1 1
size_2_2 scale=2,workers=2 2 18446744073709000000 18446744073709551615 18446744073709551615 2 2
size_32 scale=1,workers=32 1 18446744073709000000 18446744073709551615 18446744073709551615 32 1

statement ok
DROP CLUSTER foo CASCADE
Expand Down