Repository navigation
perf(sql-store): add a batch exec seam; proxy the queue capture Message - #259
Conversation
SqlExec only exposed all/run, so the search-index token insert, the aggregate tally backfill, and the rank-tuple backfill each ran their companion writes as one sequential run() per row/chunk -- a double-digit count of round trips for a single write on a .global() table with a search index plus aggregate/rank companions. Add an optional SqlExec.batch, route those three loops through it with a sequential fallback when absent, and implement it for D1 (client.batch, genuinely atomic) and the Hyperdrive postgres/mysql adapters (concurrent dispatch over the connection/pool, still non-atomic). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The queue capture harness rebuilt each delivered Message/MessageBatch as a plain object literal exposing a fixed property allowlist (ack/attempts/ body/id/retry/timestamp for a message; ackAll/messages/queue/retryAll for a batch). Any other property the real object carries read undefined with capture on (dev, Studio Queues panel) but its real value with capture off (prod) -- a dev-only divergence in the environment you debug in. Wrap with a Proxy instead: ack/retry (and ackAll/retryAll) still route through the disposition map, everything else forwards via Reflect.get pinned to the real object as receiver, so an accessor invoked through the proxy still runs against the genuine host instance. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 23 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (6)
📒 Files selected for processing (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thank you for following the naming conventions! 🙏 |
|
Thank you for confirming the Contributor License Agreement! 🙏 |
Merging this PR will not alter performance
Comparing Footnotes
|
✅ Deploy Preview for lunorash ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…sn't throw The generated D1 exec captured database.batch as a standalone reference before calling it. workerd's real D1Database.batch dereferences `this`, so the detached call throws an illegal-invocation TypeError the first time any D1-backed .global() table with a search/aggregate/rank index runs its companion-backfill write, in prod and wrangler dev alike. Call it as database.batch(...) instead, guarded by a typeof check. Also make the SqlExec.batch contract honest: its statements must be mutually independent, not ordered — the D1 impl runs them atomically in order, but the Hyperdrive Postgres/MySQL impls already dispatch them concurrently via Promise.all, which the old doc contradicted (including a purge-then-insert example that would corrupt data on Hyperdrive). Order-dependent writes belong in separate sequential run() calls, which is what every current caller already does. batch's return value was discarded by every caller, yet every implementation fabricated a result array to satisfy the type (D1: a hardcoded 0, Hyperdrive PG: same, MySQL: a real affectedRows map that existed only for a test to assert). Typed batch as Promise<void> on both SqlExec and SqlCtxExec and dropped the dead result construction along with the now-unneeded no-invalid-void-type suppression. Regenerated the codegen golden fixture and the blog example's _generated/app.ts; the only delta in both is the receiver-safe batch call.
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
A single insert/patch on a
.global()table with search-index + aggregate/rank companions cost a double-digit count of sequential Hyperdrive round trips. Adds an optionalbatchto the exec seam (atomic on D1, pipelined on Hyperdrive) routing the companion loops through it with a sequential fallback. Also: the queue capture harness re-shapedMessagethrough a fixed property allowlist (dev-only divergence — unlisted properties read undefined) → now a Proxy forwarding everything except ack/retry.Verified: sql-store 92, queue 40, codegen 973 (goldens byte-identical).
⚠ Wires D1 batch through codegen/emit-app.ts + a golden + examples/blog — merge-order vs #243/#244/#256.
🤖 Generated with Claude Code