Repository navigation
Commit f009db0
committed
review(pr69): address round-3 feedback — coordinator pattern, dynamic-race tests, statement_id plumbing
Addresses 15 round-3 review comments on the batched link-refresh
landed in 1282d43:
HIGH:
- F1 (lock-across-RPC, 900s budget): replace `TokioMutex` held
across the RPC with a CAS-claim coordinator (`AtomicBool` +
`Notify`). RPC is wrapped in `tokio::select!` against the cancel
token. RAII drop-guard releases the claim on every exit path.
- F2 (untested dynamic race): new
`refresh_does_not_disturb_concurrent_downloading_task` spawns a
real task holding `Downloading` state via `Notify`, runs a
concurrent refresh, then verifies (a) state preserved, (b) URL
swapped in cache, (c) task picks up the fresh URL on next read.
- F3 (double-spawn race): `Downloading | DownloadFailed |
DownloadRetry` now get link-only updates during refresh; only
`UrlFetched | Pending` get state → `UrlFetched`. The in-flight
task owns the state machine.
MEDIUM:
- F4 (passive expiry): post-failure stale-snapshot check now
treats `link.is_expired()` as "don't count this attempt"
alongside URL-change detection.
- F5 (Pending arm doc/code): doc rewritten to describe the arm
as forward-compatibility (every insertion uses
`ChunkEntry::with_link` today; `Pending` only exists via
`ChunkEntry::pending()` which is not currently called).
- F6 (dedupe-skip uses absolute time): both re-check sites
inside `refresh_links_batch` now skip on URL change OR
`is_expired()=false` — URL change proves a refresh landed
regardless of how TTL would flag the new link.
- F7 (duplicated stale-after-refresh defence): removed from
`refresh_links_batch`; consolidated to single site in
`download_chunk_with_retry`.
- F8 (interior holes): new contiguity check spanning
`[start_chunk_index, max_chunk_index]` in the response.
`refresh_batch_errors_on_interior_holes` covers it.
- F9 (no direct refetch_links_from tests): 4 new tests in
`link_fetcher.rs` covering cache writes, EOS reconciliation,
cursor advancement, and empty-response handling.
LOW:
- F11 (no client-side cap): `MAX_REFRESH_RESPONSE_LINKS = 10_000`
hard cap at the provider; `debug_assert!` at the link-fetcher
site documents the SEA contract assumption.
- F12 (no statement_id in logs): added `statement_id()` to
`ChunkLinkFetcher` trait (default `None`), implemented for
`SeaChunkLinkFetcherHandle`, plumbed into the provider and
attached as a `tracing` field on the three refresh-path log
lines. The "Issuing batched link refresh" line is promoted
from `debug!` to `info!`.
- F13 (naked ? on refresh error): refresh `?` now wrapped with
`Error::io().message("Link refresh RPC failed for chunk N")
.with_cause(e)` so the downstream
`error!("Failed to download chunk N: …")` log line clearly
distinguishes refresh failures from download failures.
- F14 (PR-# refs rot): swept `PR #67/68/69` references from
`streaming_provider.rs` and `link_fetcher.rs`.
- F15 (DownloadFailed reason wiped): new
`last_failure_reason: Option<String>` field on `ChunkEntry`,
preserved across `DownloadFailed → DownloadRetry` transitions.
- F16 (clock-skew boundary not exercised): boundary test now
references `LINK_EXPIRY_BUFFER_SECS - 1` and `+ 1` directly,
mirror-checks both sides.
Also folds 8 args of `download_chunk_with_retry` into a
`DownloadCtx` struct so the spawn-site is cleaner.
Test totals after this commit: 436 lib + 6 doc = 442 tests pass,
0 fail. cargo fmt + cargo clippy --all-targets -- -D warnings
both clean.
Co-authored-by: Isaac
Signed-off-by: Gopal Lal <gopal.lal@databricks.com>1 parent 1282d43 commit f009db0
3 files changed
Lines changed: 1155 additions & 248 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
117 | 128 | | |
118 | 129 | | |
119 | 130 | | |
| |||
571 | 582 | | |
572 | 583 | | |
573 | 584 | | |
574 | | - | |
575 | | - | |
| 585 | + | |
576 | 586 | | |
577 | 587 | | |
578 | 588 | | |
| |||
688 | 698 | | |
689 | 699 | | |
690 | 700 | | |
691 | | - | |
| 701 | + | |
692 | 702 | | |
693 | 703 | | |
694 | 704 | | |
| |||
756 | 766 | | |
757 | 767 | | |
758 | 768 | | |
759 | | - | |
760 | | - | |
| 769 | + | |
| 770 | + | |
761 | 771 | | |
762 | 772 | | |
763 | 773 | | |
| |||
818 | 828 | | |
819 | 829 | | |
820 | 830 | | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
821 | 846 | | |
822 | 847 | | |
823 | 848 | | |
| |||
858 | 883 | | |
859 | 884 | | |
860 | 885 | | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
861 | 890 | | |
862 | 891 | | |
863 | 892 | | |
| |||
1232 | 1261 | | |
1233 | 1262 | | |
1234 | 1263 | | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
1235 | 1420 | | |
1236 | 1421 | | |
1237 | 1422 | | |
| |||
1255 | 1440 | | |
1256 | 1441 | | |
1257 | 1442 | | |
1258 | | - | |
| 1443 | + | |
1259 | 1444 | | |
1260 | 1445 | | |
1261 | 1446 | | |
| |||
1392 | 1577 | | |
1393 | 1578 | | |
1394 | 1579 | | |
1395 | | - | |
| 1580 | + | |
1396 | 1581 | | |
1397 | 1582 | | |
1398 | 1583 | | |
| |||
0 commit comments