Skip to content

fix(relay): finish pending cache reads before yielding [H15,H17] - #9

Open
McHersheys wants to merge 1 commit into
pullboard-dev:mainfrom
McHersheys:fix/relay-page-cache-snapshot-517
Open

McHersheys wants to merge 1 commit into
pullboard-dev:mainfrom
McHersheys:fix/relay-page-cache-snapshot-517

Conversation

@McHersheys

Copy link
Copy Markdown

Fixes #8.

Change

Only pending() changes at runtime: complete one bounded .get() before each yield instead of suspending .iterate() across the client's awaited object PUT. This releases the WAL read snapshot before acknowledge() writes.

  • BigInt rowid keyset preserves insertion order and integer precision without materializing the graph.
  • CROSS JOIN keeps the rowid seek outermost; the query-plan regression rejects a per-page whole-job sort.
  • ACK validation, retries, wire format, schema, and cache custody are unchanged. No catch/retry workaround, cache reset or long transaction.
  • The cursor relies on the cache's existing native positive-rowid inserts; it does not add support for arbitrary manual rowid rewrites or promise general parallel-mutation safety.

Runtime diff: 12 added / 3 removed lines in one function. The remaining changes are eight focused real-file cache regressions and one real paged-client regression, reusing the existing client fixture and encrypted page/journal implementation.

Validation

Based on current main aeaf2ca017f2539c24a8a4e1b076fdd2160a589f; the affected runtime closure is unchanged from 0.9.2 a6a17edba700a595faa7acc281a58146cb625e23. Linux, Node 24.21.0, embedded SQLite 3.53.4; fresh synthetic homes, two actual WAL connections, no external requests or credentials.

Exact focused boundary Pass Fail Skip
New race/client tests + causal controls, unchanged main cache 3 2 expected (database is locked at ACK) 0
Patched cache + all nine new regressions 9 0 0
node --test --test-name-pattern='^pending |^paged upload ACK' \
  test/relay-page-cache.test.js test/relay-page-client.test.js

Also passed syntax checks for all three changed files and the existing wall-clock source check for both changed test files. The cache regressions cover the three causal contrasts, lazy/source-bound order, ACK persistence/reopen, another uploader's ACK, rowids beyond Number's safe range, and rowid-seek/no-sort query planning. The client regression commits on a second connection during the awaited real object PUT, then checks upload completion and exact native restore.

Earlier exact-runtime validation is reused rather than rerunning unaffected suites. The full repository gate and browser tests were not rerun for this PR. Upstream review/merge remains separate from these focused results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Relay page cache ACK can fail with SQLITE_BUSY_SNAPSHOT (517) after concurrent write

1 participant