Skip to content

Commit 1bf5cbe

Browse files
jason-price-mongodbjason-price-mongodb
and
jason-price-mongodb
authored
DOCSP-35091-majority-write-concern-updates (#5864) (#5971)
* DOCSP-35091-majority-write-concern-updates * DOCSP-35091-majority-write-concern-updates * DOCSP-35091-majority-write-concern-updates * DOCSP-35091-majority-write-concern-updates --------- Co-authored-by: jason-price-mongodb <[email protected]>
1 parent 5721d58 commit 1bf5cbe

File tree

1 file changed

+36
-32
lines changed

1 file changed

+36
-32
lines changed

source/core/transactions.txt

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ This example highlights the key components of the transactions API.
8383
/*
8484
For a replica set, include the replica set name and a seedlist of the members in the URI string; e.g.
8585
String uri = "mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017/admin?replicaSet=myRepl";
86-
For a sharded cluster, connect to the mongos instances; e.g.
86+
For a sharded cluster, connect to the mongos instances.
87+
For example:
8788
String uri = "mongodb://mongos0.example.com:27017,mongos1.example.com:27017:27017/admin";
8889
*/
8990

@@ -323,7 +324,6 @@ This example highlights the key components of the transactions API.
323324
.. literalinclude:: /driver-examples/DocumentationTransactionsExampleSpec.scala
324325
:language: scala
325326

326-
327327
.. seealso::
328328

329329
For an example in :binary:`~bin.mongo` shell, see :ref:`txn-mongo-shell-example`.
@@ -335,12 +335,12 @@ Transactions and Atomicity
335335

336336
.. include:: /includes/transactions/distributed-transaction-repl-shard-support.rst
337337

338-
Distributed transactions are atomic. They provide an "all-or-nothing"
339-
proposition:
338+
Distributed transactions are atomic:
339+
340+
- Transactions either apply all data changes or roll back the changes.
340341

341-
- When a transaction commits, all data changes made in the transaction
342-
are saved and visible outside the transaction. That is, a transaction
343-
will not commit some of its changes while rolling back others.
342+
- If a transaction commits, all data changes made in the transaction
343+
are saved and are visible outside of the transaction.
344344

345345
.. include:: /includes/extracts/transactions-committed-visibility.rst
346346

@@ -379,11 +379,11 @@ For a list of operations not supported in transactions, see
379379

380380
.. _transactions-create-collections-indexes:
381381

382-
Create Collections and Indexes In a Transaction
382+
Create Collections and Indexes in a Transaction
383383
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
384384

385-
You can perform the following operations inside of a :ref:`distributed
386-
transaction <transactions>` as long as the transaction is not a
385+
You can perform the following operations in a :ref:`distributed
386+
transaction <transactions>` if the transaction is not a
387387
cross-shard write transaction:
388388

389389
- Create collections.
@@ -397,11 +397,11 @@ When creating a collection inside a transaction:
397397
<transactions-operations-ddl-implicit>`, such as with:
398398

399399
- an :ref:`insert operation <transactions-operations-ddl-implicit>`
400-
against a non-existing collection, or
400+
for a non-existent collection, or
401401

402402
- an :ref:`update/findAndModify operation
403403
<transactions-operations-ddl-implicit>` with ``upsert: true``
404-
against a non-existing collection.
404+
for a non-existent collection.
405405

406406
- You can :ref:`explicitly create a collection
407407
<transactions-operations-ddl-explicit>` using the :dbcommand:`create`
@@ -411,7 +411,7 @@ When :ref:`creating an index inside a transaction
411411
<transactions-operations-ddl-explicit>` [#create-existing-index]_, the
412412
index to create must be on either:
413413

414-
- a non-existing collection. The collection is created as part of the
414+
- a non-existent collection. The collection is created as part of the
415415
operation.
416416

417417
- a new empty collection created earlier in the same transaction.
@@ -430,7 +430,10 @@ Restrictions
430430

431431
- For explicit creation of a collection or an index inside a
432432
transaction, the transaction read concern level must be
433-
:readconcern:`"local"`. Explicit creation is through:
433+
:readconcern:`"local"`.
434+
435+
To explicitly create collections and indexes, use the following
436+
commands and methods:
434437

435438
.. list-table::
436439
:header-rows: 1
@@ -492,10 +495,9 @@ Restricted Operations
492495
Transactions and Sessions
493496
-------------------------
494497

495-
- Transactions are associated with a session
498+
- Transactions are associated with a session.
496499

497-
- At any given time, you can have at most one open transaction for a
498-
session.
500+
- You can have at most one open transaction at a time for a session.
499501

500502
- When using the drivers, each operation in the transaction must be
501503
associated with the session. Refer to your driver specific
@@ -535,7 +537,7 @@ Transactions and Read Concern
535537
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
536538

537539
Operations in a transaction use the transaction-level :doc:`read
538-
concern </reference/read-concern>`. That is, any read concern set at
540+
concern </reference/read-concern>`. This means a read concern set at
539541
the collection and database level is ignored inside the transaction.
540542

541543
You can set the transaction-level :doc:`read concern
@@ -546,8 +548,8 @@ You can set the transaction-level :doc:`read concern
546548

547549
- If transaction-level and the session-level read concern are unset,
548550
the transaction-level read concern defaults to the client-level read
549-
concern. By default, client-level read concern is
550-
:readconcern:`"local"` for reads against the primary. See also:
551+
concern. By default, the client-level read concern is
552+
:readconcern:`"local"` for reads on the primary. See also:
551553

552554
- :ref:`transactions-read-preference`
553555
- :doc:`/reference/mongodb-defaults`
@@ -607,16 +609,16 @@ Transactions and Write Concern
607609

608610
Transactions use the transaction-level :doc:`write concern
609611
</reference/write-concern>` to commit the write operations. Write
610-
operations inside transactions must be issued without explicit write
612+
operations inside transactions must be run without an explicit write
611613
concern specification and use the default write concern. At commit
612-
time, the writes are then commited using the transaction-level write
614+
time, the writes committed using the transaction-level write
613615
concern.
614616

615617
.. tip::
616618

617-
Do not explicitly set the write concern for the individual write
619+
Don't explicitly set the write concern for the individual write
618620
operations inside a transaction. Setting write concerns for the
619-
individual write operations inside a transaction results in an error.
621+
individual write operations inside a transaction returns an error.
620622

621623
You can set the transaction-level :doc:`write concern
622624
</reference/write-concern>` at the transaction start:
@@ -661,9 +663,8 @@ values, including:
661663
`````````````````
662664

663665
- Write concern :writeconcern:`w: "majority" <"majority">` returns
664-
acknowledgement after the commit has been applied to a majority
665-
(M) of voting members, meaning the commit has been applied to the
666-
primary and (M-1) voting secondaries.
666+
acknowledgement after the commit has been applied to a majority of
667+
voting members.
667668

668669
- When you commit with :writeconcern:`w: "majority" <"majority">`
669670
write concern, transaction-level :readconcern:`"majority"` read
@@ -690,12 +691,15 @@ values, including:
690691
General Information
691692
-------------------
692693

694+
The following sections describe additional considerations for
695+
transactions.
696+
693697
Production Considerations
694698
~~~~~~~~~~~~~~~~~~~~~~~~~
695699

696-
For various production considerations with using transactions, see
700+
For transactions in production environments, see
697701
:ref:`production-considerations`. In addition, for sharded
698-
clusters, see also :ref:`production-considerations-sharded`.
702+
clusters, see :ref:`production-considerations-sharded`.
699703

700704
Arbiters
701705
~~~~~~~~
@@ -744,7 +748,7 @@ Shard Configuration Restriction
744748
Diagnostics
745749
~~~~~~~~~~~
746750

747-
MongoDB provides various transactions metrics:
751+
To obtain transaction status and metrics, use the following methods:
748752

749753
.. list-table::
750754
:widths: 40 60
@@ -785,9 +789,9 @@ MongoDB provides various transactions metrics:
785789

786790
* - :binary:`~bin.mongod` and :binary:`~bin.mongos` log messages
787791

788-
- Includes information on slow transactions, which are transactions
792+
- Includes information on slow transactions (which are transactions
789793
that exceed the :setting:`operationProfiling.slowOpThresholdMs`
790-
threshold) under the :data:`TXN` log component.
794+
threshold) in the :data:`TXN` log component.
791795

792796
.. _transactions-fcv:
793797

0 commit comments

Comments
 (0)