0.6: escalate priority aging while a queue's own lane pins the queue ring

Aperta
#886 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
18/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
postgresql, rust
Ambito
backend

Direzione di ricerca

The change lives in the Rust dispatcher and its claim function, where priority aging is computed, plus the ring-pin refresh that already reports queue_ring_pin. Start by reading how the claim function uses the aging interval and how the pin warning is produced, then reproduce the starvation with a saturating high-priority lane. Done means the starved lane is claimed and queue prune proceeds, the opt-out keeps old behaviour, and the interval computation has unit tests.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

On 0.6, a lower-priority lane of a queue with priority_aging_interval 0 can be starved for as long as a higher priority stays backlogged. While it is, it pins the queue ring and storage stops being reclaimed for every queue in the schema (#779). 0.6.18 reports the lane through queue_ring_pin but does nothing about it.

Proposal

Rust only. No schema change, and safe in any mix of 0.6 versions, because every value of the aging argument is a path the claim function already supports.

  • Each runtime that serves a queue where escalation could apply refreshes the ring pin about every 10 s. That is one query per runtime, not per dispatcher, and the leader reuses its own observation.
  • While a lane of that queue with priority P > 1 is in the pin, its dispatchers pass head_age / (P - 1) as the aging interval, so the lane's head reaches effective priority 1. They take the smallest value across the queue's pinning lanes, and use it only when it's shorter than the configured interval or the configured interval is 0. They return to the configured interval when the lane leaves the pin.
  • On by default, with a per-queue opt-out that restores today's behaviour exactly.
  • The pin warning gains a cause: paused, no_runtime (no live runtime lists the queue), starved or advancing.
  • A metric shows when escalation is active.

What changes for users

  • While one of its lanes pins the ring, the queue is served oldest-first across priorities for rows older than the pin. Queues that set aging to 0 for strict priority see this as a bounded priority inversion; the opt-out removes it.
  • It wins only when the starved head is older than the heads above it. If a higher lane is itself far behind, retention falls to that lane's lag, not to zero.
  • It does nothing for paused or unserved queues, rate limits or permits. The cause label tells operators which case they are in.

Tests

  • Through a real dispatcher: a queue at aging 0 with a saturating high priority and a starved low priority. Once the low lane pins, it is claimed and queue prune proceeds.
  • The higher lane's head is older: no change in claim order and no flapping.
  • The opt-out keeps today's behaviour and the pin is still reported.
  • Unit tests for the interval computation.

Part of #779.

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hardbyte/awa

Tutte le issue di hardbyte/awa

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.