Repository navigation
fix(sync): unblock backfill queue with owner deferral and NotFound resilience (#21122) - #21811
Conversation
|
Hi @beastoin, @Git-on-my-level, All CI contracts and automated test gates are now 100% green:
This resolves the head-of-line queue starvation and unblocks the backfill sequencer for Issue #21122. Ready for review and merge! |
Git-on-my-level
left a comment
There was a problem hiding this comment.
Reviewed all three changed files on the current head.
backend/database/sync_backfill_sequencer.py — the four new except NotFound guards (begin_job, renew_job, defer_owner, redrive_job) mirror the existing defer_pending handling and are semantically right: NotFound -> False in begin_job/renew_job reads as a stale claim so the worker abandons cleanly, NotFound -> None in redrive_job maps to sweep's existing 'raced' outcome, and defer_owner's guard matches defer_pending. NotFound is already imported in this module, so no NameError concern.
backend/utils/sync/uid_sequencer.py — deferring a failing owner by HEARTBEAT_SECONDS in sweep()'s error handler matches the existing lock_held deferral pattern and is what actually unblocks the bounded due_owners page for healthy owners (#21122). Guarding due_owners/due_pending so one failed query doesn't abort the whole tick is the right shape for a scheduler loop. Two non-blocking notes: (1) the inner 'except Exception: pass' around the deferral call silently swallows all failures — consider logging the exception type there for observability; (2) the broad excepts on the two queries will also catch programming errors such as TypeError, though the logged exception_type keeps that debuggable.
backend/tests/unit/test_sync_backfill_uid_sequencer.py — the two-tick failing/healthy owner test directly exercises the unblocking behavior, and the NotFound tolerance tests pin the new return contracts. Well-targeted suite, thank you.
No blocking issues found. Since this changes the retry cadence and failure semantics of the production sync scheduler, it needs a human maintainer sign-off before merge.
— automated maintainer review on behalf of the Omi maintainers
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
kodjima33
left a comment
There was a problem hiding this comment.
hardik4love-lang backend fix: fixes #21122, filed by trusted contributor beastoin (NOT self-filed) - no self-bounty concern despite account's other flagged PR. Clear root cause, scoped diff, CI green, 5 regression tests. Confirmed bug real on main. 5/5, merges.
|
Thank you @kodjima33, @beastoin, and @Git-on-my-level for reviewing and merging! Glad to have this critical P1 sync backfill outage resolved. Bounty Claim Details
|
|
Hi @kodjima33, @josancamon19, Following up on bounty settlement for merged PR #21811 (Issue #21122):
Whenever the batch disbursement runs, please confirm. Thank you! |
What changed and why
Fixes #21122 by resolving the escalating 500 error rate, 100% NotFound exceptions, and head-of-line blocking in the sync-backfill-uid-sequencer scheduler sweep:
econcile_uid() encounters an error, the owner is now deferred by HEARTBEAT_SECONDS (
egistry.defer_owner(owner['uid'], registry.HEARTBEAT_SECONDS, now=now)). Previously, failing owners remained with
econcile_at <= now and were re-queried on every tick, filling all 100 query slots of due_owners(limit=100) and permanently starving the remaining 50+ users with pending backfills.
edrive_job, �egin_job, and
enew_job with except NotFound: handlers (aligning with defer_pending). Missing or concurrently deleted documents are safely treated as non-fatal instead of crashing with unhandled 500 exceptions.
egistry.due_owners() and
egistry.due_pending() in sweep() against transient query timeouts, recording due_owners_error / due_pending_error while allowing remaining sweep phases to progress safely.
edrive_job does not raise.
Product invariants affected
none
How it was verified
Verified via hermetic pytest unit test suite (81/81 passing in 4.25s) covering:
Tests
�ackend/tests/unit/test_sync_backfill_uid_sequencer.py
UI evidence
UI-Evidence: none -- Backend sync backfill scheduler and Firestore resilience logic verified via unit tests.
Failure class (fixes)
Failure-Class: none