Repository navigation
SCA-2036: fix(batch): idle the record drain after a full page that admitted nothing - #24882
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
All reported issues were addressed across 5 files
You’re at about 94% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fcf606295e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if latest.get('state') != 'record_pending': | ||
| # The row left record_pending: it was admitted (by us or a peer). | ||
| return True |
There was a problem hiding this comment.
Count successful partial-record admissions as progress
When a full page contains partial-record coordinators, successful admissions are incorrectly classified as no progress. record_partial.drain_partial() admits child units through admit_page() while leaving the parent in record_pending, so this condition never counts those admissions. Consequently, even a fully productive partial-record page forces the 20-second idle wait in serving.py, delaying subsequent due recordings and limiting backlog throughput. Distinguish successful child-unit admissions from unchanged inventory polls rather than relying exclusively on the parent's state transition.
Useful? React with 👍 / 👎.
…hing Every full page rescanned immediately; with privacy-blocked heads deferred off the page (#24841), barrier-blocked rows were re-read in waves without admission (store:due 108 -> 431/s). A pass that admitted nothing now keeps the idle wait; kill switch RECORD_DRAIN_IDLE_WITHOUT_PROGRESS=off. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review (Luna, blocking): a normal return can be a no-op (an unchanged partial inventory poll), so counting every normal return made a full no-op page look productive. Progress is now the defer transaction observing the row out of record_pending. Paging/shuffle tests pin the old mode via the kill switch. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcf6062 to
d1a80c8
Compare
Co-authored-by: multica-agent <[email protected]>
What
The record drain loop has no pacing: every full page (100 rows) immediately triggers another pass. While privacy-blocked heads stayed on the page, the pass returned "blocked" and idled; #24841 moved them off, and since then any full page rescans at once even when nothing is admitted.
store:duereads rose 108 to 431/s andstore:get1,088 to 1,751/s.Change
A full page that ADMITTED nothing (every row deferred, failed or still behind its barrier) keeps the idle wait, like a privacy-blocked page. Only passes that made progress continue immediately.
RECORD_DRAIN_IDLE_WITHOUT_PROGRESS=offrestores the old behavior. It lives inconfig/record_drain.pywith the otherRECORD_DRAIN_*capacity knobs, outside flag-budget scope.With this live,
RECORD_DRAIN_PRIVACY_DEFER_SECONDScan be unset again (#24841 behavior) without the read climb.Tests
tests/unit/test_record_drain_pacing.py:test_record_drain_privacy_defer: a fully blocked page now idles one interval, and the starved row is still admitted on the next pass.test_batch_pipeline_live,test_record_drain_barrier_backoff,test_batch_record_dead_letter,test_batch_pipeline_serving,test_record_partial,test_record_gap_fillandtest_replay_harness: 489 passed on the rebased head.Review
One Luna round (blocking-only). Its blocker is fixed: a normal return can be a no-op (an unchanged partial inventory poll), so progress now counts only when the defer transaction sees the row out of
record_pending. The paging/shuffle tests pin the old mode through the kill switch. lead2 ddc817: the defer stays at its default (900) meanwhile.SCA-2036 review fix: rebased onto
main(af24862981). The defer transaction now also reports dead-letter expiry, so it returns(progress, expired)— a row that leftrecord_pendingis progress, a dead-letter expiry is not, and a peer's dead-letter is not either.test_record_drain_pacingpins both.Verify after deploy (backend-integration)
omi_firestore_billed_reads_by_caller_total{caller="database.batch_pipeline_store:due"}falls back to about 100/s.store:getfalls.Failure-Class: none
🤖 Generated with Claude Code
Landing follow-up
Operator documentation now covers the default-on pacing control, its
offrollback value, and the conservative 20-second idle for partial-record coordinators that admit children while their parent remains pending. Seebackend/docs/listen_pusher_pipeline/changes/2026-11-14-record-drain-pacing.mdand the record-drain pacing contract inbackend/docs/listen_pusher_pipeline.mdx.CI on code head
d1a80c8081: all eight backend unit shards and Backend Hermetic Merge Gate passed. The advisory Backend Emulator Proofs job failed the same six provider merge conformance cases already failing on main (54b960d947; run https://github.com/BasedHardware/omi/actions/runs/43578026940). The affected merge implementation and conformance tests are unchanged between that main snapshot and this PR. Deployment read-rate and admission checks remain post-deploy work.