Repository navigation
Remember query poll answers per request, as published PHP does - #510
Conversation
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
…ache # Conflicts: # rust/src/runtime/queries.rs
|
Updated on #499, which now carries main (with #508 and #516). #516's lock-free readiness loop met this PR's request-keyed wait in |
|
Parity run 39431600305 on This is the reference lock-pressure failure #515 corrects; its retry covers |
Part of #325. Stacked on #499.
Published PHP keeps a short-lived record for every query poll request (
QueryTaskPollRequestStore, unchanged from 2.5.14 to current main) and advertisesquery_task_poll_request_idempotency: true. #499 brings native's lease replay in line with that. This adds the rest:query_task_poll_request_idempotency: true.Records follow PHP's lifetime rules, measured from native's query poll timeout (PHP measures from its server poll timeout). Empty results live for the poll timeout plus 5 s, capped at 60 s. Claimed results live until the lease expires plus 5 s, within 5 to 3600 s. The in-flight marker and the current-request record live for the poll timeout plus 5 s. They are kept in
dw_query_cacheunder their owndw-native-query-poll:prefix, which the query task scans do not match. Keys hash namespace, queue, the registration's build ID, worker and request ID. Every new request retires up to 32 expired poll records, because workers send a fresh ID with each poll. Each step is one short transition.Polls without a request ID behave as before.
Parity probe
The same raw-protocol probe as #499, against published PHP Server 2.8.0 and this build, each on its own SQLite database. Each column shows the task leased, or
–for none; times are how long the poll took:The only remaining difference in that probe is the status name,
task/timeoutagainst PHP'sleased/empty, which #509 corrects.Tests
Three new tests in
rust/tests/execution/query_poll_requests.rs:The first two fail against #499's runtime. The third already passes there, because #499's lease replay gives the second poll the same claim; it guards the outcome.
The first #499 test now claims with one waiting poll: repeating a request ID that already got an empty answer would, by design, only get that answer again.
At
3c11e7b43the full native suite passes on SQLite locally (116 library tests, 20 ignored; 280 execution tests, 1 ignored), and the query execution tests pass on PostgreSQL 17 and MySQL 8.0. MySQL and MariaDB keys arevarchar(64), so record keys keep 128 bits of the SHA-256 digest.🤖 Generated with Claude Code