mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-05-13 03:08:40 -04:00
f394de32d9
# 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>
54 lines
1.7 KiB
TOML
54 lines
1.7 KiB
TOML
[package]
|
|
name = "spacetimedb-datastore"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license-file = "LICENSE"
|
|
description = "The datastore library for SpacetimeDB"
|
|
rust-version.workspace = true
|
|
|
|
[dependencies]
|
|
spacetimedb-data-structures.workspace = true
|
|
spacetimedb-lib = { workspace = true, features = ["serde", "metrics_impls"] }
|
|
spacetimedb-commitlog.workspace = true
|
|
spacetimedb-durability.workspace = true
|
|
spacetimedb-metrics.workspace = true
|
|
spacetimedb-primitives.workspace = true
|
|
spacetimedb-paths.workspace = true
|
|
spacetimedb-sats = { workspace = true, features = ["serde"] }
|
|
spacetimedb-schema.workspace = true
|
|
spacetimedb-table.workspace = true
|
|
spacetimedb-snapshot.workspace = true
|
|
spacetimedb-execution.workspace = true
|
|
|
|
anyhow = { workspace = true, features = ["backtrace"] }
|
|
bytes.workspace = true
|
|
derive_more.workspace = true
|
|
enum-as-inner.workspace = true
|
|
enum-map.workspace = true
|
|
itertools.workspace = true
|
|
lazy_static.workspace = true
|
|
log.workspace = true
|
|
once_cell.workspace = true
|
|
parking_lot.workspace = true
|
|
prometheus.workspace = true
|
|
smallvec.workspace = true
|
|
strum.workspace = true
|
|
thiserror.workspace = true
|
|
thin-vec.workspace = true
|
|
|
|
[features]
|
|
# Print a warning when doing an unindexed `iter_by_col_range` on a large table.
|
|
unindexed_iter_by_col_range_warn = []
|
|
default = ["unindexed_iter_by_col_range_warn"]
|
|
# Enable test helpers and utils
|
|
test = ["spacetimedb-commitlog/test"]
|
|
|
|
[dev-dependencies]
|
|
spacetimedb-lib = { path = "../lib", features = ["proptest"] }
|
|
spacetimedb-sats = { path = "../sats", features = ["proptest"] }
|
|
spacetimedb-commitlog = { path = "../commitlog", features = ["test"] }
|
|
|
|
# Also as dev-dependencies for use in _this_ crate's tests.
|
|
proptest.workspace = true
|
|
pretty_assertions.workspace = true
|