Why the db load is high again? Pipeline-svc was supposed to drain. Check what's going on.
Probing v3 host load + pipeline-svc state in parallel.
Two issues stacked. Let me unpack.
1. A 1h08m embedding-worker query is running with 4 parallel PG workers — that's the pathological readability_length scan flagged in feedback_embedding_worker_query_bug.md. It got revived earlier this session when I fixed its env. I caused this one.
2. Pipeline-svc shows claims_issued=0 despite 63k pending rows and 8K flush attempts. Flushers are running but never claiming. That's the SQLite buffer's stuck-claim class of bug.
Investigating the buffer state directly:
58,255 rows are claimed-but-not-acked by 10 dead lease IDs from prior pipeline-svc restarts. ReleaseStale exists in the code but only fires every 60s with a 5-min staleness window — and during the contention storm it couldn't even acquire the writer lock to do its job.
Checking the claim transaction itself:
busy_timeout applies to initial acquisition, not lock upgrades. Under sustained writer contention, the flusher loses every race. That's a one-line DSN fix: _txlock=immediate.
Root cause: BeginTx(ctx, nil) uses BEGIN DEFERRED. The SELECT-then-UPDATE in Claim upgrades SHARED→RESERVED at the UPDATE step; if any other writer holds RESERVED, SQLite returns SQLITE_BUSY immediately — busy_timeout doesn't apply to lock upgrades. So the flusher loses every race against HTTP-side appends. Hence claims_issued=0 permanently.
One-line DSN fix:
Building + deploying:
While that comes up, dealing with the embedding-worker query I caused. Cancelling its 4 parallel backends:
Verifying drain rate after the patch:
Fixed. Drain rate now exceeds ingest rate. Pending dropping from 63K → 29K and falling. Load already came down from 21.40 → 13.87 / 13.58 / 13.47 (1m/5m/15m, settling).
Adding to feedback memory so this doesn't recur:
Three things ship as a result:
_txlock=immediate patched in buffer.go:128 and deployed.Buffer drain rate is now >ingest rate. Load trending down. The 58K stuck rows from before the patch will release naturally as ReleaseStale finally wins the writer lock; if they don't drain in 10 min I'll force-clear them. Want me to keep watching, or move on?