Skip to content

Commit 64bdcdc

Browse files
committed
test: add tests for wallclock lag histogram
1 parent 3cd5e8c commit 64bdcdc

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

test/testdrive/wallclock-lag.td

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ $ postgres-connect name=mz_system url=postgres://mz_system:materialize@${testdri
1616

1717
$ postgres-execute connection=mz_system
1818
ALTER SYSTEM SET wallclock_lag_history_refresh_interval = '1s'
19+
ALTER SYSTEM SET wallclock_lag_histogram_refresh_interval = '1s'
1920

2021
> CREATE CLUSTER storage SIZE '1'
2122
> CREATE CLUSTER compute SIZE '1', REPLICATION FACTOR 2
@@ -109,3 +110,75 @@ snk true true
109110
src true true
110111
src_progress true true
111112
tbl true true
113+
114+
> SELECT DISTINCT o.name, l.count > 0, l.labels
115+
FROM mz_internal.mz_wallclock_global_lag_histogram l
116+
JOIN mz_objects o ON o.id = l.object_id
117+
WHERE l.object_id LIKE 'u%' AND l.lag_seconds < 10
118+
idx true {}
119+
idx_const true {}
120+
mv true {}
121+
mv_const true {}
122+
snk true {}
123+
src true {}
124+
src_progress true {}
125+
tbl true {}
126+
127+
# Test annotation of histogram measurements with labels.
128+
129+
$ postgres-execute connection=mz_system
130+
ALTER CLUSTER compute SET (WORKLOAD CLASS 'compute')
131+
ALTER CLUSTER storage SET (WORKLOAD CLASS 'storage')
132+
133+
> SELECT DISTINCT o.name, l.count > 0, l.labels
134+
FROM mz_internal.mz_wallclock_global_lag_histogram l
135+
JOIN mz_objects o ON o.id = l.object_id
136+
WHERE l.object_id LIKE 'u%' AND l.lag_seconds < 10
137+
idx true "{}"
138+
idx true "{\"workload_class\":\"compute\"}"
139+
idx_const true "{}"
140+
idx_const true "{\"workload_class\":\"compute\"}"
141+
mv true "{}"
142+
mv true "{\"workload_class\":\"compute\"}"
143+
mv_const true "{}"
144+
mv_const true "{\"workload_class\":\"compute\"}"
145+
snk true "{}"
146+
snk true "{\"workload_class\":\"storage\"}"
147+
src true "{}"
148+
src true "{\"workload_class\":\"storage\"}"
149+
src_progress true "{}"
150+
tbl true "{}"
151+
152+
# Test changing the histogram period interval.
153+
154+
$ postgres-execute connection=mz_system
155+
ALTER SYSTEM SET wallclock_lag_histogram_period_interval = '1d'
156+
157+
> CREATE TABLE tbl_1day (x int)
158+
> CREATE INDEX idx_1day ON tbl_1day (x)
159+
> SELECT DISTINCT
160+
o.name,
161+
l.period_end - l.period_start,
162+
date_trunc('day', l.period_start) = l.period_start,
163+
date_trunc('day', l.period_end) = l.period_end
164+
FROM mz_internal.mz_wallclock_global_lag_histogram l
165+
JOIN mz_objects o ON o.id = l.object_id
166+
WHERE o.name LIKE '%_1day'
167+
idx_1day 24:00:00 true true
168+
tbl_1day 24:00:00 true true
169+
170+
$ postgres-execute connection=mz_system
171+
ALTER SYSTEM SET wallclock_lag_histogram_period_interval = '1h'
172+
173+
> CREATE TABLE tbl_1hour (x int)
174+
> CREATE INDEX idx_1hour ON tbl_1day (x)
175+
> SELECT DISTINCT
176+
o.name,
177+
l.period_end - l.period_start,
178+
date_trunc('hour', l.period_start) = l.period_start,
179+
date_trunc('hour', l.period_end) = l.period_end
180+
FROM mz_internal.mz_wallclock_global_lag_histogram l
181+
JOIN mz_objects o ON o.id = l.object_id
182+
WHERE o.name LIKE '%_1hour'
183+
idx_1hour 01:00:00 true true
184+
tbl_1hour 01:00:00 true true

0 commit comments

Comments
 (0)