Skip to content

Commit 39324fe

Browse files
authored
Merge pull request #97 from norareidy/DOCSP-48660-causal-consistency-edits
DOCSP-48660: Causal consistency edits
2 parents 45b3dc2 + c1b9daf commit 39324fe

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

dbx/causal-consistency.rst

+25-13
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
1-
MongoDB enables **causal consistency** in client sessions.
2-
The causal consistency model guarantees that operations within a session
3-
run in a causal order. Clients observe results that are consistent
1+
MongoDB enables **causal consistency** in certain client
2+
sessions. The causal consistency model guarantees that in a
3+
distributed system, operations within a session run in a causal
4+
order. Clients observe results that are consistent
45
with the causal relationships, or the dependencies between
56
operations. For example, if you perform a series of operations where
67
one operation logically depends on the result of another, any subsequent
78
reads reflect the dependent relationship.
89

10+
To guarantee causal consistency, client sessions must fulfill the
11+
following requirements:
12+
13+
- When starting a session, the driver must enable the causal consistency
14+
option. This option is enabled by default.
15+
16+
- Operations must run in a single session on a single thread. Otherwise,
17+
the sessions or threads must communicate the operation time and cluster
18+
time values to each other. To view an example of two sessions that communicate
19+
these values, see the :manual:`Causal Consistency examples </core/read-isolation-consistency-recency/#examples>`
20+
in the {+mdb-server+} manual.
21+
22+
- You must use a |majority-rc| read concern.
23+
24+
- You must use a |majority-wc| write concern. This is the default write concern
25+
value.
26+
927
The following table describes the guarantees that causally
1028
consistent sessions provide:
1129

@@ -24,27 +42,21 @@ consistent sessions provide:
2442
a preceding read operation.
2543

2644
* - Monotonic writes
27-
- If a write operation must precede other write operations, the driver
45+
- If a write operation must precede other write operations, the server
2846
runs this write operation first.
2947

3048
For example, if you call |insert-one-method| to insert a document, then call
31-
|update-one-method| to modify the inserted document, the driver runs the
49+
|update-one-method| to modify the inserted document, the server runs the
3250
insert operation first.
3351

3452
* - Writes follow reads
35-
- If a write operation must follow other read operations, the driver runs
53+
- If a write operation must follow other read operations, the server runs
3654
the read operations first.
3755

3856
For example, if you call |find-one-method| to retrieve a document, then call
39-
|delete-one-method| to delete the retrieved document, the driver runs the find
57+
|delete-one-method| to delete the retrieved document, the server runs the find
4058
operation first.
4159

42-
In a causally consistent session, MongoDB ensures a
43-
causal relationship between the following operations:
44-
45-
- Read operations that have a |majority-rc| read concern
46-
- Write operations that have a |majority-wc| write concern
47-
4860
.. tip::
4961

5062
To learn more about the concepts mentioned in this section, see the

0 commit comments

Comments
 (0)