Queue storage: cancel_by_unique_key without a queue still reads every retained receipt claim
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 47/100
調査の方向性
Start by reading the unscoped cancel_by_unique_key and cancel_by_unique_key_tx paths, open_receipt_running_claims_sql, and the existing test_queue_storage_cancel_by_unique_key_reads_live_work_only test. Compare the three proposed approaches against the oldest-nonterminal semantics and the 0.7 partition migration cost. Done means the extended test shows rows read stay flat as other queues' backlogs and retained claims grow, without changing which job is selected.
索引モデルが issue の本文から書いたものです。
説明
Follow-up to #585 / #586.
With a queue, admin::cancel_by_unique_key / cancel_by_unique_key_tx now start from that queue's ready rows holding the key. They check only those jobs for being available, leased or on an open receipt claim, and answer from the deferred_jobs key index when the queue has no such row. That cost follows the queue's own rows.
Without a queue (keys inserted without by_queue), the lookup still:
- walks every lane's available rows from its claim cursor;
- reads every open receipt claim (
open_receipt_running_claims_sql) before filtering by key.
The second part grows with claim-ring retention. A long-running job keeps the oldest claim slot from pruning, so row-local claims from completed jobs pile up behind it.
Measurement
Default awa schema on PostgreSQL 16, with 180,200 retained ready rows and 120,300 retained row-local claims in other queues. The lookup was timed through cancel_by_unique_key_tx, rolled back:
| p50 | |
|---|---|
| 0.6.9 lookup (any key) | 2.8 s |
| Pre-fix 0.6.10 lookup with a queue (reads the claim ring like the unscoped path) | 9.7 s |
| Key-first lookup with a queue: missing key | 1.7 ms |
| Key-first lookup with a queue: cancel a scheduled job | 11 ms |
| Key-first lookup with a queue: cancel an available job | 20 ms |
Unscoped lookups still behave like the pre-fix row.
Options
awa.job_unique_claimsas a fast path. Look upjob_idbyunique_key, then confirm it with a per-job state check.- As #585 notes, it can't replace the lookup. A claim exists only while its job's state is inside its
unique_statesmask, and the API promises the oldest nonterminal job holding the key. - So a hit can return a job when no live job outside the mask can share the key; a miss still needs the fallback.
- It helps the common default mask, but not a missing key.
- As #585 notes, it can't replace the lookup. A claim exists only while its job's state is inside its
- A partial index on
ready_entries (unique_key) WHERE unique_key IS NOT NULL. With it, an unscoped lookup can start from the key the way a scoped one starts from the queue.- It costs every unique enqueue and needs an upgrade path for existing partitions (0.7 migration).
- Leave unscoped lookups as they are and document the cost. Point callers at
by_queuekeys or cancel-by-id for latency-sensitive paths.
Done when
An unscoped lookup's rows read stay flat as other queues' backlogs and retained claims grow (extend test_queue_storage_cancel_by_unique_key_reads_live_work_only), and the oldest-nonterminal semantics are unchanged.
- 主要言語
- Rust
- スター
- 37
- フォーク
- 8
- 平均マージ
- 14時間 16分
- マージ済み PR(30日)
- 244
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
hardbyte/awa のほかの issue
-
feature
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 18/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
operational
難易度 5/5 1週間以上 初心者へのやさしさ 8/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
jelmer/buildlog-consultant#364 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
solutionscay/skiff#310 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
valkey-io/valkey-large-object#222 ·
メンテナーはふだん 1 日以内に返信
-
bug user-priority/P1
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信