Repository navigation
fix(errors): chunk the error tick's bulk statements under the bind-parameter cap - #1271
Conversation
…rameter cap Postgres caps a statement at 32,767 bind parameters. The error tick wrote each window as one statement per table, so a window with a few thousand new fingerprints failed on the candidate upsert (12 parameters per row), rolled back, and was retried at the same width every minute: the org's cursor stopped advancing and it produced no issues, incidents or notifications. Every bulk read and write in persistErrorTickWindow now runs in chunks of 500 rows inside the same transaction. A steady-state window is still one statement per write.
|
Note A newer push replaced |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughError tick persistence now divides database reads and writes into chunks of 500 rows. The integration test covers issue and incident creation for 3,100 fingerprints, repeated observations, and incident resolution after a quiet period. ChangesError Tick Persistence
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to No confirmed issue blocks merging. Reappearing issues that qualify as regressions still receive the targeted state update. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Maple review🟢 Confidence 4/5 · likely safe to merge
What was checked
|
Why
Postgres caps one statement at 32,767 bind parameters.
persistErrorTickWindowwrote each window as one statement per table, so a window carrying a few thousand never-seen fingerprints failed on the candidate upsert (12 parameters per row):The transaction rolls back, the cursor (
error_tick_states.processed_through) stays put, and the next cron claims the same window and fails the same way. Until the window can commit, that org gets no new issues, incidents, regressions, auto-resolves or error notifications. The existing row cap (TICK_MAX_WINDOW_ROWS = 20_000) does not help: it is far above what a single statement can bind.What changed
persistErrorTickWindowruns in chunks ofBULK_CHUNK_ROWS = 500inside the same transaction: candidate upsert and delete, issue prefetch and upsert, regression flip, state prefetch, incident/state refresh, incident claim and insert, stale-incident resolve, events, notification outbox.ON CONFLICTsemantics are unchanged.Most of the diff in
error-tick-persistence.tsis re-indentation from wrapping statements; hiding whitespace shows the real change.Reviewer notes
Testing
main(the tick writes nothing) and passes with 1,000 fingerprints there, which is under the cap.vitest run src/services/errors/inpackages/backend: 263 passing.error-tick-persistence.ts; oxfmt and oxlint on the changed files.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit