Skip to content

Commit 81c9781

Browse files
author
jseldess
authored
Merge pull request #1002 from knz/gh-pages
Improve the phrasing of the page "strong consistency"
2 parents 748e01e + f88313d commit 81c9781

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

frequently-asked-questions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ For short-term failures, such as a server restart, CockroachDB uses Raft to cont
6666

6767
## How is CockroachDB strongly-consistent?
6868

69-
CockroachDB replicates your data multiple times and guarantees consistency between replicas using the [Raft consensus algorithm](https://raft.github.io/), a popular alternative to [Paxos](http://research.microsoft.com/en-us/um/people/lamport/pubs/paxos-simple.pdf). A consensus algorithm guarantees that any majority of replicas together can always provide the most recently written data on reads. Writes must reach a majority of replicas (2 out of 3 by default) before they are considered committed. If a write does not reach a majority of replicas, it will fail, not be permanent, and will never be visible to readers. This means that clients always see serializable consistency when viewing data (i.e., stale reads are not possible).
70-
71-
For a detailed look at how we've tested CockroachDB for correctness and consistency, see [DIY Jepsen Testing of CockroachDB](https://www.cockroachlabs.com/blog/diy-jepsen-testing-cockroachdb/).
69+
CockroachDB guarantees the SQL isolation level "serializable", the highest defined by the SQL standard.
70+
It does so by combining the Raft consensus algorithm for writes and a custom time-based synchronization algorithms for reads.
71+
See our description of [strong consistency](strong-consistency.html) for more details.
7272

7373
## Why is CockroachDB SQL?
7474

strong-consistency.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,44 @@ 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 using the [Raft consensus algorithm](https://raft.github.io/), a popular alternative to [Paxos](http://research.microsoft.com/en-us/um/people/lamport/pubs/paxos-simple.pdf). A consensus algorithm guarantees that any majority of replicas together can always provide the most recently written data on reads. Writes must reach a majority of replicas (2 out of 3 by default) before they are considered committed. If a write does not reach a majority of replicas, it will fail, not be permanent, and will never be visible to readers. This means that clients always see serializable consistency when viewing data (i.e., stale reads are not possible).
7+
CockroachDB replicates your data multiple times and guarantees consistency between replicas.
88

9+
Key properties:
10+
11+
- CockroachDB guarantees serializable SQL transactions
12+
[as long as system clocks are synchronized with NTP](https://www.cockroachlabs.com/blog/living-without-atomic-clocks/)
913
- No downtime for server restarts, machine failures, or datacenter outages
1014
- Local or wide-area replication with no stale reads on failover
1115
- Employs Raft, a popular successor to Paxos
1216

17+
How does this work?
18+
19+
- Stored data is versioned with MVCC, so reads simply limit
20+
their scope to the data visible at the time the read transaction started.
21+
22+
- Writes are serviced using the
23+
[Raft consensus algorithm](https://raft.github.io/), a popular
24+
alternative to
25+
[Paxos](http://research.microsoft.com/en-us/um/people/lamport/pubs/paxos-simple.pdf).
26+
A consensus algorithm guarantees that any majority of replicas
27+
together always agree on whether an update was committed
28+
successfully. Updates (writes) must reach a majority of replicas (2
29+
out of 3 by default) before they are considered committed.
30+
31+
To ensure that a write transaction does not interfere with
32+
read transactions that start after it, CockroachDB also uses
33+
a [timestamp cache](https://www.cockroachlabs.com/blog/serializable-lockless-distributed-isolation-cockroachdb/)
34+
which remembers when data was last read by ongoing transactions.
35+
36+
This ensures that clients always observe serializable consistency
37+
with regards to other concurrent transactions.
38+
1339
<img src="images/2strong-consistency.png" alt="Strong consistency in CockroachDB" style="width: 400px" />
1440

1541
## See Also
1642

43+
- [Serializable, Lockless, Distributed: Isolation in CockroachDB](https://www.cockroachlabs.com/blog/serializable-lockless-distributed-isolation-cockroachdb/)
1744
- [Consensus, Made Thrive](https://www.cockroachlabs.com/blog/consensus-made-thrive/)
1845
- [Trust, But Verify: How CockroachDB Checks Replication](https://www.cockroachlabs.com/blog/trust-but-verify-cockroachdb-checks-replication/)
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)