Repository navigation
docs(zero-swift): storage waits, schemas sharing a table name, and an IVM difference from JS - #43
Merged
Merged
Conversation
…ble name DESIGN.md says how long the main thread waits on a locked or busy database: about 5 s to open one, up to about 10 s in flush() or close() (the queued write, then one retry; it said two retries, but busyRetries is 1). The codegen README says two generated schemas with a table of the same name can't share a module, since both declare tx.mutate.<table>. Amp-Thread-ID: https://ampcode.com/threads/T-01a17664-8fd0-76be-8fd5-75ac6e7aa0d8 Co-authored-by: tmm <tmm@tmm.dev>
JS's FlippedJoin reads only the first child row of a pushed parent, and when that read goes through a Take whose partition wasn't fetched before, the Take asserts 'Unexpected early return prevented full hydration'. Swift keeps working. Against JS patched to read the rest of such a fetch (as the comment by the assertion proposes), Swift matched on 126 such fuzz cases and 1,988 controls, seeds 1 to 10; the patched JS's incremental views matched a fresh hydration after every batch. Amp-Thread-ID: https://ampcode.com/threads/T-01a17664-8fd0-76be-8fd5-75ac6e7aa0d8 Co-authored-by: tmm <tmm@tmm.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three notes left over from the hardening work (#38).
Zero.initwhen another program holds the file locked, before the client falls back to memory, and up to about 10 s inflush()orclose()(the queued write, then one retry). It also fixes the paragraph above it, which said two retries; fix(zero-swift): harden the client against crashes, data loss, and JS divergences #38 shippedbusyRetries = 1.tx.mutate.<table>(Swift: "invalid redeclaration"). In separate modules it works, and code that imports both names the row type:TypedTableMutator<Issue>(tx.mutate). Checked withswiftcon both layouts.whereExistsreads only the first child row of a row a change brings (FlippedJoin.#pushParent). When that read goes through alimitwhose partition wasn't fetched before, JS's Take asserts "Unexpected early return prevented full hydration" and the poke or mutation fails. Swift keeps working. To check that Swift's rows are right, I patched JS's Take and Cap (temporarily) to read the rest of such a fetch, as the comment by the assertion proposes. On seeds 1–10, Swift matched that JS (changes, rows, notifications) on all 126 such cases and 1,988 controls, and the patched JS's incremental views matched a fresh hydration after every batch.Not included: sending
deleteClientsafter collecting a database. The collected database's clients belong to its own client groups, JS sends only the current group's IDs (DeleteClientsManager.onClientsDeleted), and zero-cache deletes only clients of the connection's group, so matching JS would change nothing on the server.Docs only; a patch changeset so the README reaches npm.