Repository navigation
Replay a live query lease only to the poll request that claimed it - #499
Conversation
Native returned a worker's live query lease to any later poll from that worker. Published PHP replays a live lease only to a poll carrying the matching poll_request_id, and native does not advertise query poll-request idempotency, so its SDK workers send no id. A late handler cancelled at its view of the query deadline polled again a fraction of a millisecond before the stored expiry and received the identical claim a second time. That was the intermittent "Compare published query deadlines and installed Worker authority" failure, reproduced locally with full logs. A live lease held by a current registration now stays with the poll that claimed it, whatever its owner. A lease held by a stale registration can still be reclaimed. Three native controls asserted the old replay; they now assert that the later poll receives no task while the original claim still completes. With the previous runtime, two of them fail; the third polls through a reconfigured runtime where the old replay never applied. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
First qualification at |
The previous commit stopped replaying a live lease to any later poll from the same worker. The installed Python SDK retries a timed-out query poll once with the same poll_request_id, so that retry would no longer recover its own claim and the task would stay leased until its lease expired. As in published PHP, the claim now records its poll_request_id, a retry of that same request receives the lease again, and every other poll stays an independent slot. The ID is not delivered to the worker. A non-string ID is refused like other invalid poll requests. A raw-protocol probe against published PHP Server 2.8.0 and this build leases, replays and withholds the same tasks for repeated, newer, missing, foreign-worker and concurrent duplicate request IDs. Native still lacks PHP's cached empty results, supersession of an older waiting poll and its leased/empty poll statuses, so it keeps advertising query_task_poll_request_idempotency as false. Part of #325. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Published PHP keeps a short-lived record for every query poll request and advertises query_task_poll_request_idempotency. Native now does the same: - a retry of a request gets the answer the original got, including an empty one, and a remembered task is delivered again only while this worker's registration still holds its live lease; - a duplicate of a request still waiting shares that request's answer; - a new request becomes the worker's current one, and a waiting poll whose request is no longer current ends at once with an empty answer. Records live in dw_query_cache under their own prefix, with PHP's lifetime rules measured from the native query poll timeout. Each new request retires up to 32 expired poll records. Polls without a request ID are unchanged. A raw-protocol probe now matches published PHP Server 2.8.0 on every step except the leased/empty status names. New tests cover remembered empty answers, supersession and shared duplicates on SQLite, PostgreSQL 17 and MySQL 8.0. Part of #325. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o rust-325-query-poll-cache # Conflicts: # rust/src/runtime/queries.rs
|
Updated with main (including #509). The full SQLite execution suite passes locally on the merge (278 tests). Its own |
… rust-325-query-lease-replay
…ache # Conflicts: # rust/src/runtime/queries.rs
Remember query poll answers per request, as published PHP does
|
#510 merged into this branch (
|
|



Part of #325.
Native replayed a live query lease to any later poll from the worker that held it. An independent second poll could therefore receive a task its worker was already running. The query-authority cohort recorded exactly that as a second claim at the deadline boundary (port log, known gaps).
Published PHP replays a live lease only to a poll that repeats the claiming
poll_request_id. The installed Python SDK depends on this: it retries a timed-out query poll once with the same ID. Native now does the same:poll_request_id, which is not delivered to the worker;Parity probe
A raw-protocol probe ran against published PHP Server 2.8.0 (the query-authority reference image) and against this build, each with its own SQLite database. Each column shows the task leased, or
–for none:Three PHP behaviors are still missing, so native keeps advertising
query_task_poll_request_idempotency: false:leased/empty; native reportstask/timeout.Tests
query_lease_replays_only_to_the_poll_request_that_claimed_itcovers the same, a newer, a missing and a foreign-worker request ID, the invalid ID and the post-completion poll.At
6663ab64athe full native suite passes on SQLite locally: 116 library tests (20 ignored) and 277 execution tests (1 ignored).🤖 Generated with Claude Code