SQLite: order orchestration fetches by readiness (visible_at, then id), as PostgreSQL does
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 70/100
Hướng nghiên cứu
Start with the two ORDER BY q.id orchestrator fetch queries in src/providers/sqlite.rs (around lines 781 and 800) and compare them with the readiness ordering in duroxide-pg's migrations/0025_fetch_orchestration_lease_at_claim.sql. Add a migration under migrations/ for the index, then add provider validation tests next to test_worker_deferred_item_does_not_starve_ready_work in src/provider_validation/queue_semantics.rs. Done when the abandon and timer cases both pass against SQLite.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Follow-up from #74. Low priority: consistency with PostgreSQL and future-proofing, not a merge blocker. Line numbers are at 112dcf0.
Problem
#74 changed the SQLite worker fetch to ORDER BY q.visible_at, q.id, so work that becomes ready late no longer goes ahead of work that was ready earlier. The orchestrator queue still picks the ready row with the lowest id: ORDER BY q.id in src/providers/sqlite.rs:781 (with a capability filter) and :800 (without).
PostgreSQL already orders this fetch by readiness: duroxide-pg migrations/0025_fetch_orchestration_lease_at_claim.sql:85 and :95 use ORDER BY q.visible_at, q.id. The two providers disagree, and no provider validation test checks the order.
Two kinds of rows become ready long after they get their id:
TimerFiredrows are inserted when the timer is scheduled, withvisible_at = fire_at(sqlite.rs:1587-1590). A one-hour timer carries an id from an hour earlier.abandon_orchestration_itemwith a delay keeps the row and its id and movesvisible_at(sqlite.rs:2248-2250). The dispatcher does this for an incompatible version (src/runtime/dispatchers/orchestration.rs:442), history that fails to deserialize (:585), a continue-as-new successor that is not visible yet (:624), an unregistered orchestration (:745), and exhausted failure-commit or ack retries (:1048,:1239).
Under a backlog, these rows go ahead of instances that have been ready longer.
Impact
Low. Every orchestration abandon uses up an attempt, so a failing instance can jump the queue at most max_attempts times before it is poisoned, and a timer fires once. This is priority inversion, not starvation. Correctness is not affected: one fetch takes all ready messages of the chosen instance (sqlite.rs:876-889), in id order (:896). It matters most in bursts, such as a deploy that drops an orchestration registration, or many timers firing together.
Proposed change
ORDER BY q.visible_at, q.idin both orchestrator queries (sqlite.rs:781,:800).- A migration with
CREATE INDEX IF NOT EXISTS idx_orch_ready_order ON orchestrator_queue(visible_at, id);. File-backed databases get indexes only throughmigrations/(sqlx::migrate!atsqlite.rs:172), as f8d4db7 did for the worker queue. The existingidx_orch_visible(visible_at, lock_token)breaks ties bylock_token, notid. - A provider validation test, the orchestration counterpart of
test_worker_deferred_item_does_not_starve_ready_work(src/provider_validation/queue_semantics.rs:121):- Abandon: start instances A and B, fetch A, abandon it with a 1 ms delay, and wait 20 ms. The next fetch must return B.
- Timer: enqueue a
TimerFiredfor A that fires in 10 ms, then a message for B. After 20 ms, the next fetch must return B, which became ready first.
By code reading, SQLite fails the timer case today and PostgreSQL passes it.
Filed for @affandar from the #74 review.
- Ngôn ngữ chính
- Rust
- Star
- 235
- Fork
- 63
- Merge trung bình
- 2 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 7
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/duroxide
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
One failed session lock renewal loses the session: no retry, no log, no signal to running activitiesĐang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của microsoft/duroxide
Issue tương tự
-
bug file-compat priority: high
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
storytold/photocraft#11330 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
redis-compat
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
say: name hint should only fire on @tags, not bare words or text inside linksCó thể đã có người làm @morganparadis đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
CakeRepository/agentshangout#501 ·
-
area:ui could docs good first issue
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100