# Description of Changes Implements [subscribing to durable commits](https://github.com/clockworklabs/SpacetimeDBPrivate/issues/1594). The setting works on a per-connection level, and essentially just delays sending transaction updates until the transaction is reported as durable by the database. For connectionless SQL operations, the setting works per-request. No SQL syntax is provided by this patch to toggle the configuration. After some deliberation, I opted to obtain the offset when a transaction commits (as opposed to when it starts). This creates some mild inconvenience, because we prevent the transaction from committing until the corresponding subscription updates are enqueued. The strategy is, however, more correct should we ever support weaker isolation levels, and it is easier to document. Follow-ups include: - Provide SQL syntax (`SET synchronous_commit = ON` or something) - C# and TypeScript SDKs - Reference docs? # API and ABI breaking changes Not breaking, but adds a parameter to the subscribe and sql endpoints. # Expected complexity level and risk 4 To the author's understanding, ordering of outbound messages is not changed by this patch, even if there are messages that don't have a transaction offset (such as error messages). I.e. while waiting for the transaction offset of a message to become durable, no message enqueued after that message will be delivered. This may not be desirable in some cases. The patch may contain concurrency bugs, e.g. awaiting futures that may never resolve. # Testing - [x] Implemented a new test in the `module_subscription_actor` module - [x] Added unit tests for the core logic in `ClientConnectionReceiver` It would be desirable to also have integration-level tests, but I'm currently unsure how to write those without being able to control if and when the database reports an offset as durable. --------- Signed-off-by: Kim Altintop <kim@eagain.io> Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
Migration note
We are in the process of moving from the spacetimedb-docs repo to the docs subdirectory of SpacetimeDB. Any new changes should be made there. The spacetimedb-docs repo will only be updated on release. Apologies in advance for any sharp edges while the migration is in progress.
SpacetimeDB Documentation
This repository contains the markdown files which are used to display documentation on our website.
Making Edits
To make changes to our docs, you can open a pull request in this repository. You can typically edit the files directly using the GitHub web interface, but you can also clone our repository and make your edits locally. To do this you can follow these instructions:
- Fork our repository
- Clone your fork:
git clone ssh://git@github.com/<username>/SpacetimeDB
cd SpacetimeDB/docs
- Make your edits to the docs that you want to make + test them locally
- Commit your changes:
git add .
git commit -m "A specific description of the changes I made and why"
- Push your changes to your fork as a branch
git checkout -b a-branch-name-that-describes-my-change
git push -u origin a-branch-name-that-describes-my-change
- Go to our GitHub and open a PR that references your branch in your fork on your GitHub
NOTE! If you make a change to
nav.tsyou will have to runnpm run buildto generate a newdocs/nav.jsfile.
CLI Reference Section
- Run
cargo run --features markdown-docs -p spacetimedb-cli > docs/cli-reference.md - Run
pnpm format
Checking Links
We have a CI job which validates internal links. You can run it locally with npm run check-links. This will print any internal links (i.e. links to other docs pages) whose targets do not exist, including fragment links (i.e. #-ey links to anchors).
License
This documentation repository is licensed under Apache 2.0. See LICENSE.txt for more details.