Commit 9542977
Read aggregates in one page, and refuse to page them
Paged $apply results from this feed are silently wrong. The row count is right -
it matches the equivalent SQL exactly, 86184 for ssh successes and 91453 for the
(ip,response_status) grouping - but the rows are not: some are duplicated and
others dropped, differently on every run.
$top=100000 (1 page) 86184 rows, 86184 distinct ip, 0 duplicated
$top=100000 (again) 86184 rows, 86184 distinct ip - identical
$top=25000 (4 pages) 86184 rows, 61348 distinct ip, 24836 duplicated
$top=25000 (again) 86184 rows, 57882 distinct ip, 28302 duplicated
$top=10000 (9 pages) 86184 rows, 58991 distinct ip
SQL over the same window agrees with the single-page read, so the engine, filter
and aggregate are all correct; each page appears to be a fresh execution of an
unordered query, so $skip lands somewhere different every time.
This had already reached production and left no trace: the derived lists carried
130408 lines for 80048 real http hosts and 123701 for 90221 https, so refresh was
re-grabbing duplicates inside a single run while tens of thousands of known hosts
were missing from both the refresh queue and the discovery exclusion.
$top now sits at the server's ceiling, where every query this project issues fits
in one page, and grouped_max/distinct_values raise rather than follow a nextLink.
The failure mode to design against is a plausible answer, not an error -
responsive.py keeps the previous list when a read raises and cannot tell a corrupt
answer from a good one.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 6957146 commit 9542977
2 files changed
Lines changed: 89 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
53 | 75 | | |
54 | 76 | | |
55 | 77 | | |
| |||
130 | 152 | | |
131 | 153 | | |
132 | 154 | | |
| 155 | + | |
133 | 156 | | |
134 | 157 | | |
135 | 158 | | |
136 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
137 | 164 | | |
138 | 165 | | |
139 | 166 | | |
| |||
157 | 184 | | |
158 | 185 | | |
159 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
160 | 194 | | |
161 | 195 | | |
162 | 196 | | |
| |||
198 | 232 | | |
199 | 233 | | |
200 | 234 | | |
201 | | - | |
| 235 | + | |
| 236 | + | |
202 | 237 | | |
203 | 238 | | |
204 | 239 | | |
| |||
230 | 265 | | |
231 | 266 | | |
232 | 267 | | |
233 | | - | |
| 268 | + | |
| 269 | + | |
234 | 270 | | |
235 | 271 | | |
236 | 272 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
52 | | - | |
| 54 | + | |
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
| |||
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
63 | | - | |
| 65 | + | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| |||
78 | 81 | | |
79 | 82 | | |
80 | 83 | | |
81 | | - | |
| 84 | + | |
82 | 85 | | |
83 | 86 | | |
84 | 87 | | |
| |||
254 | 257 | | |
255 | 258 | | |
256 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
0 commit comments