@@ -6,9 +6,10 @@ Causal Consistency and Read and Write Concerns
6
6
7
7
With MongoDB's :ref:`causally consistent client sessions <sessions>`,
8
8
different combinations of read and write concerns provide different
9
- :ref:`causal consistency guarantees <causal-consistency-guarantees>`. When
10
- causal consistency is defined to imply durability, then the following table lists
11
- the specific guarantees provided by the various combinations:
9
+ :ref:`causal consistency guarantees <causal-consistency-guarantees>`.
10
+
11
+ The following table lists the specific guarantees that various
12
+ combinations provide:
12
13
13
14
.. list-table::
14
15
:header-rows: 1
@@ -48,24 +49,27 @@ the specific guarantees provided by the various combinations:
48
49
- |checkmark|
49
50
-
50
51
51
- If causal consistency implies durability, then, as seen from the table,
52
- only read operations with :readconcern:`"majority"` read concern and
53
- write operations with :writeconcern:`"majority"` write concern can
54
- guarantee all four causal consistency guarantees. That is,
52
+ If you want causal consistency with data durability, then, as
53
+ seen from the table, only read operations with
54
+ :readconcern:`"majority"` read concern and write operations with
55
+ :writeconcern:`"majority"` write concern can guarantee all four causal
56
+ consistency guarantees. That is,
55
57
:ref:`causally consistent client sessions <sessions>` can only
56
58
guarantee causal consistency for:
57
59
58
- - Read operations with :readconcern:`"majority"` read concern; i.e. the
59
- read operations that return data that has been acknowledged by a
60
- majority of the replica set members and is durable.
60
+ - Read operations with :readconcern:`"majority"` read concern; in other
61
+ words, the read operations that return data that has been
62
+ acknowledged by a majority of the replica set members and is durable.
61
63
62
- - Write operations with :writeconcern:`"majority"` write concern; i.e.
63
- the write operations that request acknowledgement that the operation
64
- has been applied to a majority of the replica set's voting members.
64
+ - Write operations with :writeconcern:`"majority"` write concern;
65
+ in other words, the write operations that request acknowledgement
66
+ that the operation has been applied to a majority of the replica
67
+ set's voting members.
65
68
66
- If causal consistency does not imply durability (i.e. writes may be
67
- rolled back), then write operations with :writeconcern:`{ w: 1 }
68
- <\<number\>>` write concern can also provide causal consistency.
69
+ If you want causal consistency without data durability (meaning that
70
+ writes may be rolled back), then write operations with
71
+ :writeconcern:`{ w: 1 } <\<number\>>` write concern can also provide
72
+ causal consistency.
69
73
70
74
.. note::
71
75
@@ -190,8 +194,8 @@ the following causal consistency guarantees:
190
194
* - |checkmark| **Writes follow reads**
191
195
192
196
- Write\ :sub:`2` updates data on ``P``\ :sub:`new` that
193
- reflects a state of the data after Read\ :sub:`1` (i.e. an
194
- earlier state reflects the data read by Read\ :sub:`1`).
197
+ reflects a state of the data after Read\ :sub:`1` (meaning
198
+ that an earlier state reflects the data read by Read\ :sub:`1`).
195
199
196
200
.. note:: Scenario 2 (Read Concern "majority" and Write Concern "majority")
197
201
@@ -244,7 +248,7 @@ the following causal consistency guarantees:
244
248
* - |checkmark| **Monotonic reads**
245
249
246
250
- Read\ :sub:`2` reads data from ``S``\ :sub:`3` that reflects
247
- a state after Read\ :sub:`1` (i.e. an earlier state is
251
+ a state after Read\ :sub:`1` (meaning that an earlier state is
248
252
reflected in the data read by Read\ :sub:`1`).
249
253
250
254
* - |checkmark| **Monotonic writes**
@@ -255,8 +259,8 @@ the following causal consistency guarantees:
255
259
* - |checkmark| **Writes follow reads**
256
260
257
261
- Write\ :sub:`2` updates data on ``P``\ :sub:`new` that
258
- reflects a state of the data after Read\ :sub:`1` (i.e. an
259
- earlier state reflects the data read by Read\ :sub:`1`).
262
+ reflects a state of the data after Read\ :sub:`1` (meaning
263
+ that an earlier state reflects the data read by Read\ :sub:`1`).
260
264
261
265
.. _causal-rc-majority-wc-1:
262
266
@@ -265,11 +269,12 @@ Read Concern ``"majority"`` and Write concern ``{w: 1}``
265
269
266
270
The use of read concern :readconcern:`"majority"` and write concern
267
271
:writeconcern:`{ w: 1 } <\<number\>>` in a causally consistent session
268
- provides the following causal consistency guarantees *if causal consistency implies durability*:
272
+ provides the following causal consistency guarantees *if you want
273
+ causal consistency with data durability*:
269
274
270
275
|xmark| Read own writes |checkmark| Monotonic reads |xmark| Monotonic writes |checkmark| Writes follow reads
271
276
272
- *If causal consistency does not imply durability*:
277
+ *If you want causal consistency without data durability*:
273
278
274
279
|checkmark| Read own writes |checkmark| Monotonic reads |checkmark| Monotonic writes |checkmark| Writes follow reads
275
280
@@ -279,8 +284,8 @@ provides the following causal consistency guarantees *if causal consistency impl
279
284
:sub:`old` and ``P``\ :sub:`new` can fulfill writes with
280
285
:writeconcern:`{ w: 1 } <\<number\>>` write concern, a client session
281
286
could issue the following sequence of operations
282
- successfully but not be causally consistent **if causal consistency
283
- implies durability**:
287
+ successfully but not be causally consistent **if you want causal
288
+ consistency with data durability**:
284
289
285
290
.. list-table::
286
291
:header-rows: 1
@@ -315,21 +320,21 @@ provides the following causal consistency guarantees *if causal consistency impl
315
320
316
321
- Write\ :sub:`1` will roll back when the network partition is healed.
317
322
318
- |arrow| *If causal consistency implies durability*
323
+ |arrow| *If you want causal consistency with data durability*
319
324
320
325
.. list-table::
321
326
:class: no-outer-border
322
327
:widths: 20 80
323
328
324
329
* - |xmark| **Read own writes**
325
330
326
- - Read\ :sub:`1` reads data from ``S``\ :sub:`2` that does not
331
+ - Read\ :sub:`1` reads data from ``S``\ :sub:`2` that doesn't
327
332
reflect a state after Write\ :sub:`1`.
328
333
329
334
* - |checkmark| **Monotonic reads**
330
335
331
336
- Read\ :sub:`2` reads data from ``S``\ :sub:`3` that reflects
332
- a state after Read\ :sub:`1` (i.e. an earlier state is
337
+ a state after Read\ :sub:`1` (meaning that an earlier state is
333
338
reflected in the data read by Read\ :sub:`1`).
334
339
335
340
* - |xmark| **Monotonic writes**
@@ -340,11 +345,11 @@ provides the following causal consistency guarantees *if causal consistency impl
340
345
* - |checkmark| **Writes follow reads**
341
346
342
347
- Write\ :sub:`2` updates data on ``P``\ :sub:`new` that
343
- reflects a state after Read\ :sub:`1` (i.e. an
348
+ reflects a state after Read\ :sub:`1` (meaning that an
344
349
earlier state reflects the data read by Read\
345
350
:sub:`1`).
346
351
347
- |arrow| *If causal consistency does not imply durability*
352
+ |arrow| *If you want causal consistency without data durability*
348
353
349
354
.. list-table::
350
355
:class: no-outer-border
@@ -359,7 +364,7 @@ provides the following causal consistency guarantees *if causal consistency impl
359
364
* - |checkmark| **Monotonic reads**
360
365
361
366
- Read\ :sub:`2` reads data from ``S``\ :sub:`3` that reflects
362
- a state after Read\ :sub:`1` (i.e. an earlier state is
367
+ a state after Read\ :sub:`1` (meaning that an earlier state is
363
368
reflected in the data read by Read\ :sub:`1`).
364
369
365
370
* - |checkmark| **Monotonic writes**
@@ -371,7 +376,7 @@ provides the following causal consistency guarantees *if causal consistency impl
371
376
* - |checkmark| **Writes follow reads**
372
377
373
378
- Write\ :sub:`2` updates data on ``P``\ :sub:`new` that
374
- reflects a state after Read\ :sub:`1` (i.e. whose
379
+ reflects a state after Read\ :sub:`1` (meaning whose
375
380
earlier state reflects the data read by Read\
376
381
:sub:`1`).
377
382
@@ -409,21 +414,21 @@ provides the following causal consistency guarantees *if causal consistency impl
409
414
:sub:`old` and ``S``\ :sub:`1`, and the two members sync from the
410
415
other members of the replica set.
411
416
412
- |arrow| *If causal consistency implies durability*
417
+ |arrow| *If you want causal consistency with data durability*
413
418
414
419
.. list-table::
415
420
:class: no-outer-border
416
421
:widths: 20 80
417
422
418
423
* - |xmark| **Read own writes**
419
424
420
- - The data read by Read\ :sub:`1` does not reflect the results
425
+ - The data read by Read\ :sub:`1` doesn't reflect the results
421
426
of Write\ :sub:`1`, which has rolled back.
422
427
423
428
* - |checkmark| **Monotonic reads**
424
429
425
430
- Read\ :sub:`2` reads data from ``S``\ :sub:`3` that reflects
426
- a state after Read\ :sub:`1` (i.e. whose
431
+ a state after Read\ :sub:`1` (meaning whose
427
432
earlier state reflects the data read by Read\
428
433
:sub:`1`).
429
434
@@ -436,10 +441,10 @@ provides the following causal consistency guarantees *if causal consistency impl
436
441
* - |checkmark| **Writes follow reads**
437
442
438
443
- Write\ :sub:`2` updates data on ``P``\ :sub:`new` that
439
- reflects a state after Read\ :sub:`1` (i.e. whose
444
+ reflects a state after Read\ :sub:`1` (meaning whose
440
445
earlier state reflects the data read by Read\ :sub:`1`).
441
446
442
- |arrow| *If causal consistency does not imply durability*
447
+ |arrow| *If you want causal consistency without data durability*
443
448
444
449
.. list-table::
445
450
:class: no-outer-border
@@ -453,7 +458,7 @@ provides the following causal consistency guarantees *if causal consistency impl
453
458
* - |checkmark| **Monotonic reads**
454
459
455
460
- Read\ :sub:`2` reads data from ``S``\ :sub:`3` that reflects
456
- a state after Read\ :sub:`1` (i.e. an earlier state
461
+ a state after Read\ :sub:`1` (meaning that an earlier state
457
462
reflects the data read by Read\ :sub:`1`).
458
463
459
464
* - |checkmark| **Monotonic writes**
@@ -465,8 +470,8 @@ provides the following causal consistency guarantees *if causal consistency impl
465
470
* - |checkmark| **Writes follow reads**
466
471
467
472
- Write\ :sub:`2` updates data on ``P``\ :sub:`new` that
468
- reflects a state after Read\ :sub:`1` (i.e. an earlier state
469
- reflects the data read by Read\ :sub:`1`).
473
+ reflects a state after Read\ :sub:`1` (meaning that an
474
+ earlier state reflects the data read by Read\ :sub:`1`).
470
475
471
476
.. _causal-rc-local-wc-1:
472
477
@@ -524,9 +529,9 @@ some situations, but not necessarily in all situations.
524
529
525
530
* - |xmark| Monotonic reads
526
531
527
- - Read\ :sub:`2` reads data from ``S``\ :sub:`3` that does not
528
- reflect a state after Read\ :sub:`1` (i.e. an earlier state
529
- does not reflect the data read by Read\ :sub:`1`).
532
+ - Read\ :sub:`2` reads data from ``S``\ :sub:`3` that doesn't
533
+ reflect a state after Read\ :sub:`1` (meaning that an earlier
534
+ state doesn't reflect the data read by Read\ :sub:`1`).
530
535
531
536
* - |xmark| Monotonic writes
532
537
@@ -536,8 +541,9 @@ some situations, but not necessarily in all situations.
536
541
* - |xmark| Write follow read
537
542
538
543
- Write\ :sub:`2` updates data on ``P``\ :sub:`new` that does
539
- not reflect a state after Read\ :sub:`1` (i.e. an earlier
540
- state does not reflect the data read by Read\ :sub:`1`).
544
+ not reflect a state after Read\ :sub:`1` (meaning that an
545
+ earlier state doesn't reflect the data read by Read\
546
+ :sub:`1`).
541
547
542
548
.. _causal-rc-local-wc-majority:
543
549
@@ -589,14 +595,14 @@ some situations, but not necessarily in all situations.
589
595
590
596
* - |xmark| Read own writes.
591
597
592
- - Read\ :sub:`1` reads data from ``S``\ :sub:`1` that does not
598
+ - Read\ :sub:`1` reads data from ``S``\ :sub:`1` that doesn't
593
599
reflect a state after Write1\ :sub:`1`.
594
600
595
601
* - |xmark| Monotonic reads.
596
602
597
- - Read\ :sub:`2` reads data from ``S``\ :sub:`3` that does not
598
- reflect a state after Read\ :sub:`1` (i.e. an earlier state
599
- does not reflect the data read by Read\ :sub:`1`).
603
+ - Read\ :sub:`2` reads data from ``S``\ :sub:`3` that doesn't
604
+ reflect a state after Read\ :sub:`1` (meaning that an earlier
605
+ state doesn't reflect the data read by Read\ :sub:`1`).
600
606
601
607
* - |checkmark| Monotonic writes
602
608
@@ -606,8 +612,9 @@ some situations, but not necessarily in all situations.
606
612
* - |xmark| Write follow read.
607
613
608
614
- Write\ :sub:`2` updates data on ``P``\ :sub:`new` that does
609
- not reflect a state after Read\ :sub:`1` (i.e. an earlier
610
- state does not reflect the data read by Read\ :sub:`1`).
615
+ not reflect a state after Read\ :sub:`1` (meaning that an
616
+ earlier state doesn't reflect the data read by Read\
617
+ :sub:`1`).
611
618
612
619
613
620
.. |arrow| unicode:: U+27A4
0 commit comments