Repository navigation
fix(sync): release backfill inflight slot on terminal status poll after stale self-heal - #18906
Merged
kodjima33 merged 1 commit intoSep 25, 2026
Conversation
…er stale self-heal
When a backfill sync job goes stale in 'processing' (or unstarted 'queued'
cloud_tasks dispatch), get_sync_job(job_id) self-heals the job to 'failed'
on read and records the pending dead-letter entry. Because job['status'] is
already 'failed' when get_sync_job returns to get_sync_job_status, the
subsequent is_sync_job_stale(job) branch in get_sync_job_status evaluates
to False and never reaches release_backfill_slot(uid, job_id).
Once get_sync_job_status verifies the durable dead-letter record for a
terminal ('failed' or 'partial_failure') backfill job, release the per-UID
backfill slot via release_backfill_slot(uid, job_id) (which uses an atomic
Lua compare-and-delete keyed to job_id) so client retries are not blocked
for 48h by HTTP 429 backfill_paced.
Failure-Class: none
kodjima33
approved these changes
Sep 25, 2026
kodjima33
left a comment
Collaborator
There was a problem hiding this comment.
Scoped backfill-slot release fix, root cause stated with line refs, tests added, CI green. Confidence 5/5.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #18905
Summary
processing(or unstartedqueuedcloud_tasksdispatch),get_sync_job(job_id)self-healsjob[status] = failedon read and writes the pending dead-letter record before returning toget_sync_job_status.job[status]is alreadyfailedwhenget_sync_jobreturns, the subsequentis_sync_job_stale(job)branch inget_sync_job_status(backend/routers/sync.py:1457) evaluates toFalseand never reachesrelease_backfill_slot(uid, job_id), leavingsync_backfill:inflight:{uid}locked to the deadjob_idfor its 48-hour TTL (BACKFILL_SLOT_TTL_SECONDS) and blocking client WAL retry uploads withHTTP 429(backfill_paced).release_backfill_slot(uid, job_id)inget_sync_job_statusonce the durable dead-letter record (pendingordead_letter) is verified for a terminal (failed/partial_failure) backfill job (leaving the slot intact if the dead-letter check fails closed with503).test_poll_stale_self_healed_backfill_releases_inflight_slotandtest_poll_failed_backfill_without_ledger_does_not_release_slotinbackend/tests/unit/test_sync_dead_letters.py.Product invariants affected
none
Failure-Class: none