Commit 67183be
committed
compute: split hydration into dataflow and durable stages
The hydration lifecycle has four stages, installed, started, hydrated and
written, where written is the moment the output is durable in persist.
Indexes do not write, so for them the last two coincide. Materialized
views do, and the gap is the initial snapshot write.
hydrated_at was stamped off the reported output frontier, which is the
meet of the write and compute frontiers. That made it a measure of
durability rather than of computation, and worse, not uniform across
workers: the sink's mint operator maintains the shared sink frontier on
one elected worker and clears it on all the others, so the same dataflow
reported hydration at two different stages depending on which worker's
log a consumer read.
Both stages are wanted. A replacement materialized view runs in read-only
mode and does not write until a cutover, so folding durability into
hydrated_at would measure how long a human took to promote, where the
dataflow stage is the earliest moment the replacement could have been
promoted. Durability is what readiness needs, and readiness is served by
time_ns and the relations built on it.
So the signal is split rather than moved. The Hydration event still fires
on the output frontier crossing and still owns time_ns, which is what
keeps mz_compute_hydration_times, mz_compute_hydration_statuses,
mz_hydration_statuses and the blue-green readiness query reporting
exactly what they reported before. A new DataflowHydrated event fires on
the dataflow's own progress frontier and owns hydrated_at, along with the
started_at backfill, since that is now the handler responsible for the
installed_at <= started_at <= hydrated_at invariant.
report_frontiers derives the progress frontier as the compute probe where
one exists and the write frontier otherwise, so an index keeps stamping
from its trace upper and the index degeneracy falls out rather than being
special-cased. Subscribes report from their own frontier through the same
observer, unchanged.
Also drops the doc's claim that a REFRESH materialized view reports a
refresh interval rather than hydration work. REFRESH EVERY takes an
implicit refresh at creation, so its first write is prompt, and the claim
was wrong for that variant. What is verified, and kept, is that the
compute probe sits before apply_refresh deliberately, so hydration reads
the pre-rounding frontier.
Testdrive coverage asserts both workers report hydrated_at for a
multi-worker materialized view, that they agree closely, and that
hydration never postdates the durable moment time_ns measures. A small
view writes in milliseconds, so these lock the invariants rather than
proving the stages are separate.
Part of CPU-226
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018ZVCMBSLdxzGus78ZKWhZz1 parent f9be4ed commit 67183be
4 files changed
Lines changed: 223 additions & 36 deletions
File tree
- doc/developer/design
- src/compute/src
- logging
- test/testdrive
Lines changed: 55 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
112 | 126 | | |
113 | 127 | | |
114 | 128 | | |
| |||
163 | 177 | | |
164 | 178 | | |
165 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
166 | 201 | | |
167 | 202 | | |
168 | 203 | | |
| |||
274 | 309 | | |
275 | 310 | | |
276 | 311 | | |
277 | | - | |
278 | | - | |
279 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
280 | 318 | | |
281 | 319 | | |
282 | 320 | | |
| |||
312 | 350 | | |
313 | 351 | | |
314 | 352 | | |
315 | | - | |
| 353 | + | |
316 | 354 | | |
317 | 355 | | |
318 | 356 | | |
| |||
391 | 429 | | |
392 | 430 | | |
393 | 431 | | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
409 | 444 | | |
410 | 445 | | |
411 | 446 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
921 | 921 | | |
922 | 922 | | |
923 | 923 | | |
| 924 | + | |
| 925 | + | |
924 | 926 | | |
925 | 927 | | |
926 | 928 | | |
| |||
950 | 952 | | |
951 | 953 | | |
952 | 954 | | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
953 | 979 | | |
954 | 980 | | |
955 | 981 | | |
| |||
996 | 1022 | | |
997 | 1023 | | |
998 | 1024 | | |
| 1025 | + | |
| 1026 | + | |
999 | 1027 | | |
1000 | 1028 | | |
1001 | 1029 | | |
| |||
1209 | 1237 | | |
1210 | 1238 | | |
1211 | 1239 | | |
| 1240 | + | |
1212 | 1241 | | |
1213 | 1242 | | |
1214 | 1243 | | |
| |||
1998 | 2027 | | |
1999 | 2028 | | |
2000 | 2029 | | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
2001 | 2037 | | |
2002 | 2038 | | |
2003 | 2039 | | |
| |||
2036 | 2072 | | |
2037 | 2073 | | |
2038 | 2074 | | |
| 2075 | + | |
2039 | 2076 | | |
2040 | 2077 | | |
2041 | 2078 | | |
| |||
2094 | 2131 | | |
2095 | 2132 | | |
2096 | 2133 | | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
| 2137 | + | |
| 2138 | + | |
2097 | 2139 | | |
2098 | 2140 | | |
2099 | 2141 | | |
2100 | 2142 | | |
2101 | 2143 | | |
2102 | 2144 | | |
2103 | 2145 | | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
2104 | 2163 | | |
2105 | 2164 | | |
2106 | 2165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
161 | 171 | | |
162 | 172 | | |
163 | 173 | | |
| |||
236 | 246 | | |
237 | 247 | | |
238 | 248 | | |
| 249 | + | |
| 250 | + | |
239 | 251 | | |
240 | 252 | | |
241 | 253 | | |
| |||
887 | 899 | | |
888 | 900 | | |
889 | 901 | | |
| 902 | + | |
890 | 903 | | |
891 | 904 | | |
892 | 905 | | |
| |||
1082 | 1095 | | |
1083 | 1096 | | |
1084 | 1097 | | |
1085 | | - | |
1086 | | - | |
1087 | 1098 | | |
1088 | 1099 | | |
1089 | 1100 | | |
| |||
1100 | 1111 | | |
1101 | 1112 | | |
1102 | 1113 | | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
1103 | 1148 | | |
1104 | 1149 | | |
1105 | | - | |
1106 | | - | |
1107 | | - | |
1108 | | - | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
1109 | 1154 | | |
1110 | 1155 | | |
1111 | 1156 | | |
| |||
1115 | 1160 | | |
1116 | 1161 | | |
1117 | 1162 | | |
| 1163 | + | |
1118 | 1164 | | |
1119 | 1165 | | |
1120 | 1166 | | |
1121 | | - | |
| 1167 | + | |
1122 | 1168 | | |
1123 | 1169 | | |
1124 | 1170 | | |
1125 | | - | |
1126 | | - | |
1127 | | - | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
1128 | 1174 | | |
1129 | 1175 | | |
1130 | 1176 | | |
| |||
1544 | 1590 | | |
1545 | 1591 | | |
1546 | 1592 | | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
1547 | 1605 | | |
1548 | 1606 | | |
1549 | 1607 | | |
| |||
0 commit comments