Skip to content

Commit 6688f12

Browse files
committed
strong_consistency: improve the text.
1 parent e603c40 commit 6688f12

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

strong-consistency.md

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,33 @@ summary: CockroachDB implements consistent replication via majority consensus be
44
toc: false
55
---
66

7-
CockroachDB replicates your data multiple times and guarantees consistency between replicas
8-
using the [Raft consensus algorithm](https://raft.github.io/), a popular alternative to
9-
[Paxos](http://research.microsoft.com/en-us/um/people/lamport/pubs/paxos-simple.pdf).
10-
A consensus algorithm guarantees that any majority of replicas together can always provide
11-
the most recently written data on reads. Writes must reach a majority of replicas (2 out of
12-
3 by default) before they are considered committed. If a write does not reach a majority of
13-
replicas, it will fail, not be permanent, and will never be visible to readers. This means
14-
that clients always see serializable consistency when viewing data (i.e., stale reads are
15-
not possible).
7+
CockroachDB replicates your data multiple times and guarantees consistency between replicas.
8+
9+
How does this work?
10+
11+
- Stored data is versioned with MVCC, so reads simply limit
12+
their scope to the data visible at the time the read transaction started.
13+
14+
- Writes are serviced using the
15+
[Raft consensus algorithm](https://raft.github.io/), a popular
16+
alternative to
17+
[Paxos](http://research.microsoft.com/en-us/um/people/lamport/pubs/paxos-simple.pdf).
18+
A consensus algorithm guarantees that any majority of replicas
19+
together always agree on whether an update was committed
20+
successfully. Updates (writes) must reach a majority of replicas (2
21+
out of 3 by default) before they are considered committed. If an
22+
update does not reach a majority of replicas, it will fail, not be
23+
permanent, and will never be visible to readers.
24+
25+
To ensure that a write transaction does not interfere with
26+
read transactions that start after it, CockroachDB also uses
27+
a [timestamp cache](https://www.cockroachlabs.com/blog/serializable-lockless-distributed-isolation-cockroachdb/)
28+
which remembers when data was last read by ongoing transactions.
29+
30+
This ensures that clients always observe serializable consistency
31+
with regards to other concurrent transactions.
32+
33+
Key properties:
1634

1735
- No downtime for server restarts, machine failures, or datacenter outages
1836
- Local or wide-area replication with no stale reads on failover
@@ -24,3 +42,6 @@ not possible).
2442

2543
- [Consensus, Made Thrive](https://www.cockroachlabs.com/blog/consensus-made-thrive/)
2644
- [Trust, But Verify: How CockroachDB Checks Replication](https://www.cockroachlabs.com/blog/trust-but-verify-cockroachdb-checks-replication/)
45+
- [Serializable, Lockless, Distributed: Isolation in CockroachDB](https://www.cockroachlabs.com/blog/serializable-lockless-distributed-isolation-cockroachdb/)
46+
- [Living Without Atomic Clocks](https://www.cockroachlabs.com/blog/living-without-atomic-clocks/)
47+
- [The CockroachDB Architecture Document](https://github.com/cockroachdb/cockroach/blob/master/docs/design.md)

0 commit comments

Comments
 (0)