Repository navigation
fix(sync): run direct backfill work at once when the UID sequencer is off - #21909
Merged
Merged
Conversation
… off With SYNC_BACKFILL_UID_SEQUENCER=off, the worker still pulled any direct backfill job back into the one-per-UID queue whenever that user had an active or pending sequenced entry, and marked a direct run that paused the queue's drain. Every user with a backlog therefore stayed fully serialized after the kill switch, which is exactly the population the switch is for. When the sequencer is off the worker now processes the job directly and leaves the existing sequenced entries to drain in parallel.
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.
Summary
With
SYNC_BACKFILL_UID_SEQUENCER=off, the backfill worker now processes direct backfill jobs immediately. Before this change it still sent them back into the one-per-UID queue whenever the user had an active or pending sequenced entry.Why
#21883 turned the sequencer off, and it is off on both prod sync services now. Ten minutes after the switch, sequencer registrations were unchanged (1,414 → 1,594 per 10 min), and every one came from the backfill worker.
The worker's cutover branch (
run_sync_job, epoch-less backfill payloads) did two things when the flag was off:refresh_direct_run, which makeskick()defer that user's sequenced drain.All 1,724 users with a backlog still have pending entries (502k total), so the kill switch changed nothing for them.
Change
_run_sync_job_body, and the already-sequenced entries keep draining throughkick/Scheduler in parallel.sequencer_epoch) are untouched. They still finish their job and kick the next one.Trade-off: with the flag off, a user's direct jobs and their leftover sequenced jobs can run concurrently. That is the pre-sequencer behaviour, paced by the Cloud Tasks queue.
Product invariants affected
none
Failure class
Failure-Class: new
Adds
FC-kill-switch-keeps-the-gated-path: a rollout flag turned off must stop admitting new work to the gated path, even while leftover state from the flag-on period exists.Verification
test_old_backfill_task_migrates_on_flag_on_and_runs_direct_when_offnow asserts that, with the flag off, a direct job runs and is not registered for an idle owner, an active owner, or a pending backlog, and thatrefresh_direct_runis never called. The old code registers in the last two cases, so the test fails on it.test_sync_task_persistence_fence_terminalizes_backfill_and_releases_its_slotno longer pads the adoption read that the flag-off path no longer makes.tests/unit/test_sync_cloud_tasks.pyandtests/unit/test_sync_backfill_uid_sequencer.py: the same 11 failures as unmodifiedmainin my local environment, and nothing new.🤖 Generated with Claude Code