Skip to main content
Swytch Documentation
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Consistency and Acknowledgments

Swytch is an in-memory database with causal history and serializable transactions within an agreement domain. Use this contract to decide when an application can report success, when it can retry, and what storage it needs.

Transactions

A transaction groups the reads and writes needed for one decision. With interactive SSI, commands return snapshot results immediately, but those results remain provisional until EXEC succeeds. Other connections see committed state.

A successful transaction commit requires responses from all current subscribers to the transaction’s keys. Peers exchange the envelope and conflict evidence before confirmation. This requirement applies under both safe and unsafe; the latter skips the availability preflight, not the commit protocol.

A key without other subscribers can commit locally. Subscriptions identify participants through use. Merely adding nodes does not make every node a subscriber or create a replica of every key.

Client outcomeMeaningApplication action
Successful EXEC arrayThe transaction committed; entries contain command resultsHandle any command-level errors in that array and report the resulting decision
Null EXECConflict or failed watch caused an abortRetry all reads and decisions from a fresh MULTI
AMBIGUOUSCommit may have occurredReconcile the operation ID before repeating work
Lost connection while waiting for commitThe client lacks a definitive outcomeTreat the outcome as unknown

Runtime errors in individual commands do not automatically abort an entire transaction. Issue DISCARD if a failed command invalidates the application’s decision. The transaction guide provides the full workflow.

Ordinary commands

Ordinary commands use causal effects and operation-specific execution paths. Some perform implicit transactions; others propagate effects without that transaction barrier. Do not infer a universal subscriber acknowledgment barrier from a successful ordinary command reply.

Causal dependencies preserve the relationship between observed operations. Concurrent effects are reconstructed according to their semantics. An increment and a replacement assignment do not make the same claim about their result. Use the data guides and command reference for the operation being integrated.

Independent domains

Transactions are serializable within their participating domain. Disconnected domains have independent histories; they cannot establish a shared global serial order without communication. When histories meet, Swytch reconstructs a valid combined order or exposes qualifying conflicts for reconciliation.

This preserves evidence of decisions rather than discarding a former primary’s history during failover. A retained transaction history and a currently visible value are different things. Conflict reports let applications inspect that evidence.

Replication and durable storage

BoundaryWhat it establishes
Transaction acknowledgmentCommit coordination with the current subscribers completed
Local mirror syncThe synced resident effects reached this node’s disk
Cloud upload acknowledgmentThe uploaded effects reached the network storage tier

Local disk sync and Cloud uploads are asynchronous. Transaction success does not wait for either. Surviving subscribers can retain shared state after a node fails; losing every holder requires a retained storage copy. Durability and tiering describes the choices, including eviction and recovery behavior.

Evidence

The Jepsen harness checks operation histories under declared faults. Its SSI workload checks strict serializability in the tested configuration. Model specifications and deterministic regression tests provide additional, distinct evidence. None should be represented as a result for a different revision or topology.

For comparisons, Redis and Valkey’s own documentation explicitly permits acknowledged-write loss during failover. Apply the same questions about success, history, and storage to each database.