Repository navigation
Commit 915118a
meta_worker: unwrap attach_id on table_function_{cardinality,statistics,dynamic_to_string} + magic-prefix wrapper
Two related fixes plus observability.
1. **Missing unwraps.** `MetaWorker.{bind, init, catalog_*, aggregate_*}`
all unwrap the sub-worker index byte before delegating to the matching
sub-worker. `table_function_cardinality`, `table_function_statistics`,
and `table_function_dynamic_to_string` did not — they passed the
wrapped attach_id straight through. Result: `process()` derived its
storage shard_key from the unwrapped (sub-worker-side) attach_id while
`dynamic_to_string` derived from the still-wrapped (meta-side)
attach_id, so storage reads landed on a different CF Durable Object
than the writes. Symptom: `EXPLAIN ANALYZE` lost user-supplied Extra
Info on attached catalogs. Fix: shared `_unwrap_bind_call_attach_id`
helper threaded through all three sites.
2. **Self-identifying wrapper.** The wrap format was `bytes([idx]) +
attach_id` — a bare 1-byte prefix indistinguishable from a real
attach_id whose first byte happened to match. New format prepends a
3-byte `b"MW\x00"` magic, so `_unwrap` raises `KeyError` (callers fall
back to a function-name registry scan) when input isn't actually a
MetaWorker wrap. 4 bytes of total overhead instead of 1. Storage
shards prefixed with `att-4d570000…` are visibly MetaWorker-routed.
3. **Dispatch tagging.** Every MetaWorker wrap/unwrap site now emits a
`vgi.meta_worker` debug log with `method`, `function`, `sub_worker_index`,
`wrapped_aid` (short hex), `unwrapped_aid` (short hex). Startup emits
one info-level mapping of `{index, worker_class, catalogs}` per
sub-worker so a stray `wrapped_aid=…` line in a dispatch log is
self-explanatory. `function_storage._derive_shard_key` emits a
matching `vgi.storage.shard` debug log on every BoundStorage
construction so routing bugs can be diffed line-by-line between
meta-side dispatch and storage-side shard derivation.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 8934996 commit 915118a
3 files changed
Lines changed: 236 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
27 | 34 | | |
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
31 | 38 | | |
32 | 39 | | |
33 | | - | |
| 40 | + | |
34 | 41 | | |
35 | 42 | | |
36 | 43 | | |
37 | 44 | | |
38 | 45 | | |
39 | 46 | | |
40 | | - | |
41 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
42 | 53 | | |
43 | 54 | | |
44 | 55 | | |
| |||
47 | 58 | | |
48 | 59 | | |
49 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
50 | 65 | | |
51 | 66 | | |
52 | | - | |
53 | | - | |
| 67 | + | |
| 68 | + | |
54 | 69 | | |
55 | 70 | | |
56 | 71 | | |
57 | | - | |
58 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
59 | 84 | | |
60 | 85 | | |
61 | 86 | | |
| |||
434 | 459 | | |
435 | 460 | | |
436 | 461 | | |
| 462 | + | |
437 | 463 | | |
438 | 464 | | |
439 | 465 | | |
440 | 466 | | |
441 | 467 | | |
442 | 468 | | |
443 | | - | |
| 469 | + | |
| 470 | + | |
444 | 471 | | |
445 | 472 | | |
446 | 473 | | |
| |||
488 | 515 | | |
489 | 516 | | |
490 | 517 | | |
| 518 | + | |
491 | 519 | | |
492 | 520 | | |
493 | 521 | | |
494 | 522 | | |
495 | 523 | | |
496 | 524 | | |
497 | | - | |
| 525 | + | |
| 526 | + | |
498 | 527 | | |
499 | 528 | | |
500 | 529 | | |
| |||
0 commit comments