Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

Commit f67e067

Browse files
Merge #330
330: add consistency model doc r=MarinPostma a=MarinPostma Co-authored-by: ad hoc <[email protected]>
2 parents 4de673d + 63cd6bd commit f67e067

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/CONSISTENCY_MODEL.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Sqld consistency model
2+
3+
## Building on top of sqlite
4+
5+
sqlite offers a strictly serializable consistency model. Since sqld is built on top of it, it inherits some of its properties.
6+
7+
## Transactional consistency
8+
9+
Any transaction in sqld is equivalent to sqlite transaction. When a transaction is opened, on the primary or replicas alike, the view that the transaction get is "frozen" is time. any write performed by a transaction is at the same time immediately visible to itself, as well as completely isolated from any other ongoing transactions. Therefore, sqld offers serializable transactions
10+
11+
## Real-time guarantees
12+
13+
All operations occurring on the primary are linearizable. However, there is no guarantee that changes made to the primary are immediately visible to all replicas. Sqld guarantees that a process (connection) will always see its write. Given that the primary is linearizable, it means that a process is guaranteed to see all writes that happened on the primary up until (at least) the last write performed by the process. This is not true for two distinct processes on the same replica, however, that can potentially read two different points in time. For example, a read for process A on the replica might return immediately returning some state, while a read on process B issued at the same time would need to wait to sync with the primary.
14+
15+
Note that reads on a replica are monotonical: once a value has been witnessed, only a value at least as recent can be witnessed on any subsequent read.
16+
17+
There are no global ordering guarantees provided by sqld: any two instances needn't be in sync at any time.

0 commit comments

Comments
 (0)