Queue stripes: jobs inserted through the SQL path are never claimed, and routing ignores the ordering key
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 38/100
Direzione di ricerca
Start by tracing physical_queues_for_logical, insert_job_compat, enqueue_params_batch, enqueue_params_copy, and queue_stripe_for_enqueue; compare how SQL compatibility inserts and Rust enqueue paths choose queues and stripes. Run the deterministic reproduction tests described in the issue against a PostgreSQL-backed queue with multiple stripes. Done means compat-inserted jobs are claimable, routing preserves per-key FIFO and spreads single inserts, and the docs and CHANGELOG explain recovery of jobs left in q.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
With queue_stripe_count (queue_storage_queue_stripe_count) above 1, queue storage has three routing defects. All three reproduce on main and on release/0.6.6 (PostgreSQL 18.6) with deterministic tests.
1. Jobs inserted through the SQL compat path are never claimed
Striped workers claim only from the physical queues q#0 … q#N-1 (physical_queues_for_logical). insert_job_compat and the batch compat insert have no stripe logic, so they write to the unstriped logical queue q, which a striped worker never reads. With 2 stripes, six jobs inserted through insert_many, a multi-row insert_many and insert_many_copy_from_pool were claimed 0 times; the same jobs were all claimed by a store with 1 stripe.
This path is used by the Rust insert, insert_with, insert_prepared, insert_many, insert_many_skip_unique_conflicts and insert_many_copy families (pool and transaction), Python insert, insert_sync, transactional inserts and insert_many_copy, cron, and follow-up jobs enqueued by handlers. The docs warn only about producers that write to queue storage directly, which implies this path is safe.
2. Routing ignores ordering_key, so per-key FIFO does not hold
queue_stripe_for_enqueue picks a stripe by hashing unique_key, otherwise by the job's index in the batch (enqueue_params_batch, enqueue_params_copy). It never reads ordering_key. Jobs that share an ordering key therefore land on different stripes, and stripes are claimed independently. With 2 stripes, key K inserted as K1 alone, then [other, K2], then [K3, K4] was claimed in the order 2, 1, 4, 3. PartitionedQueue key routing is affected the same way, because it only sets the queue and the ordering key.
3. Single-job inserts all land on stripe 0
A batch of one always has index 0, so every single-job insert without a unique key goes to q#0: 80 of 80 in a test with 4 stripes. Striping only spreads batch producers.
The unique-key hash also uses std's DefaultHasher, whose output is not guaranteed to be stable across Rust releases.
Fix
- The striped claim,
prepare_queueand the queue count paths also read the unstriped logical queueq, so jobs written there are claimed. This is additive and safe in a mixed fleet. - Routing hashes
ordering_keyfirst, thenunique_key, with the stableordering_key_hash64, using bits independent of the enqueue-shard pick; otherwise it uses a per-job value that actually spreads (job id, or a randomly seeded per-instance counter). - Docs and CHANGELOG describe the defect and tell operators running with stripes above 1 how to find jobs left in
q.
Changing routing only changes which of the existing q#N names a job gets; claim, count, move and admin paths already read every stripe. During a rolling upgrade a key's backlog can be split between old and new routing, so per-key order is restored once old producers are gone and their backlog has drained.
Target: 0.6.18, then main. enqueue_shards covers the same need per queue, honours the ordering key and works from SQL producers; deprecating queue_stripe_count in 0.7 is tracked separately.
- Lingua principale
- Rust
- Stelle
- 37
- Fork
- 8
- Merge medio
- 14h 16m
- PR unite (30g)
- 244
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di hardbyte/awa
-
feature
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 18/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
-
0.6.19 release checklistApertaoperational
Difficoltà 5/5 Più di una settimana Idoneità per principianti 8/100
hardbyte/awa#861 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
hardbyte/awa#841 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di hardbyte/awa
Issue simili
-
Mobile release verification reports missing build inputs with a custom Cargo target directoryApertabug good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
getsotto/sotto-authenticator#139 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
registrystack/registry-stack#2924 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
foundry-rs/starknet-foundry#4733 ·
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100