Repository navigation
Conversation
|
Claude finished @clonder's task in 2m 32s —— View job Review: lease-based preprocessing work queue
The design looks solid. Claiming is now a single
Main concern (inline): while a new version is being backfilled, every polling worker blocks on the Smaller points:
Tests: coverage is good: concurrent claims, re-claim after expiry rejecting the old attempt, a rolled-back mixed batch, migration tests, and carrying the attempt id through the Python pipeline. What's missing is a test for concurrent first-time extracts of a new pipeline version, which is the backfill path above. I did not run the backend or Python tests. This review comes from reading the code only. |
There was a problem hiding this comment.
It would be great to also add to the PR description why there are 3 separate db migration files, why split up the work? also can they all be released to prod together in one rollout?
…older backend during the release are also queued - we can remove this code after the release
continues #7075 after #7133 took the batching half.
Backstory and Issue
Every worker now tries to claim sequences by inserting rows. With 64 workers, about half of ~1M claim attempts lost the race, and the contention made requests so slow that workers hit their 30s timeout and crash-looped (101 restarts in the baseline run). #7133 already improved performance by batching insertions, this PR adds leases to prevent workers "fighting" each other.
A result was stored for whoever held the row, nobody checked which worker. A batch slower than the stale timeout overwrites the result of the worker that re-claimed it, and that worker gets a 422 for its whole batch.
Now every sequence is already in the queue as an UNPROCESSED row. A worker claims a batch atomically (FOR UPDATE SKIP LOCKED) and gets a lease: a claim ID + expiry time. If the worker dies, the lease expires and the batch goes back to the queue. Submitting results requires the matching claim ID, so a worker that lost its lease can't overwrite anyone else's work.
On the 64 pod runs from #7075 claim attempts went from 1,008,177 to 25,468, worker restarts from 101 to 0.
BREAKING CHANGES
Pipelines must send back the
processingAttemptIdthey got fromextract-unprocessed-data.PR Checklist
🚀 Preview: Add
previewlabel to enable