Skip to content

Commit 0e657e4

Browse files
jason-price-mongodbjason-price-mongodb
and
jason-price-mongodb
authored
DOCSP-35091-majority-write-concern-updates (#5864) (#5966)
* 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 96755b2 commit 0e657e4

File tree

1 file changed

+38
-34
lines changed

1 file changed

+38
-34
lines changed

source/core/transactions.txt

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ upper-right to set the language of the following example.
7171
/*
7272
For a replica set, include the replica set name and a seedlist of the members in the URI string; e.g.
7373
String uri = "mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017/admin?replicaSet=myRepl";
74-
For a sharded cluster, connect to the mongos instances; e.g.
74+
For a sharded cluster, connect to the mongos instances.
75+
For example:
7576
String uri = "mongodb://mongos0.example.com:27017,mongos1.example.com:27017:27017/admin";
7677
*/
7778

@@ -268,7 +269,6 @@ upper-right to set the language of the following example.
268269
.. literalinclude:: /driver-examples/DocumentationTransactionsExampleSpec.scala
269270
:language: scala
270271

271-
272272
.. seealso::
273273

274274
For an example in :binary:`~bin.mongosh`, see
@@ -281,12 +281,12 @@ Transactions and Atomicity
281281

282282
.. include:: /includes/transactions/distributed-transaction-repl-shard-support.rst
283283

284-
Distributed transactions are atomic. They provide an "all-or-nothing"
285-
proposition:
284+
Distributed transactions are atomic:
285+
286+
- Transactions either apply all data changes or roll back the changes.
286287

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

291291
.. include:: /includes/extracts/transactions-committed-visibility.rst
292292

@@ -325,11 +325,11 @@ For a list of operations not supported in transactions, see
325325

326326
.. _transactions-create-collections-indexes:
327327

328-
Create Collections and Indexes In a Transaction
328+
Create Collections and Indexes in a Transaction
329329
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
330330

331-
You can perform the following operations inside of a :ref:`distributed
332-
transaction <transactions>` as long as the transaction is not a
331+
You can perform the following operations in a :ref:`distributed
332+
transaction <transactions>` if the transaction is not a
333333
cross-shard write transaction:
334334

335335
- Create collections.
@@ -343,11 +343,11 @@ When creating a collection inside a transaction:
343343
<transactions-operations-ddl-implicit>`, such as with:
344344

345345
- an :ref:`insert operation <transactions-operations-ddl-implicit>`
346-
against a non-existing collection, or
346+
for a non-existent collection, or
347347

348348
- an :ref:`update/findAndModify operation
349349
<transactions-operations-ddl-implicit>` with ``upsert: true``
350-
against a non-existing collection.
350+
for a non-existent collection.
351351

352352
- You can :ref:`explicitly create a collection
353353
<transactions-operations-ddl-explicit>` using the :dbcommand:`create`
@@ -357,7 +357,7 @@ When :ref:`creating an index inside a transaction
357357
<transactions-operations-ddl-explicit>` [#create-existing-index]_, the
358358
index to create must be on either:
359359

360-
- a non-existing collection. The collection is created as part of the
360+
- a non-existent collection. The collection is created as part of the
361361
operation.
362362

363363
- a new empty collection created earlier in the same transaction.
@@ -378,7 +378,10 @@ Restrictions
378378

379379
- For explicit creation of a collection or an index inside a
380380
transaction, the transaction read concern level must be
381-
:readconcern:`"local"`. Explicit creation is through:
381+
:readconcern:`"local"`.
382+
383+
To explicitly create collections and indexes, use the following
384+
commands and methods:
382385

383386
.. list-table::
384387
:header-rows: 1
@@ -435,10 +438,9 @@ Restricted Operations
435438
Transactions and Sessions
436439
-------------------------
437440

438-
- Transactions are associated with a session
441+
- Transactions are associated with a session.
439442

440-
- At any given time, you can have at most one open transaction for a
441-
session.
443+
- You can have at most one open transaction at a time for a session.
442444

443445
- When using the drivers, each operation in the transaction must be
444446
associated with the session. Refer to your driver specific
@@ -478,7 +480,7 @@ Transactions and Read Concern
478480
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
479481

480482
Operations in a transaction use the transaction-level :doc:`read
481-
concern </reference/read-concern>`. That is, any read concern set at
483+
concern </reference/read-concern>`. This means a read concern set at
482484
the collection and database level is ignored inside the transaction.
483485

484486
You can set the transaction-level :doc:`read concern
@@ -489,8 +491,8 @@ You can set the transaction-level :doc:`read concern
489491

490492
- If transaction-level and the session-level read concern are unset,
491493
the transaction-level read concern defaults to the client-level read
492-
concern. By default, client-level read concern is
493-
:readconcern:`"local"` for reads against the primary. See also:
494+
concern. By default, the client-level read concern is
495+
:readconcern:`"local"` for reads on the primary. See also:
494496

495497
- :ref:`transactions-read-preference`
496498
- :doc:`/reference/mongodb-defaults`
@@ -550,16 +552,16 @@ Transactions and Write Concern
550552

551553
Transactions use the transaction-level :doc:`write concern
552554
</reference/write-concern>` to commit the write operations. Write
553-
operations inside transactions must be issued without explicit write
555+
operations inside transactions must be run without an explicit write
554556
concern specification and use the default write concern. At commit
555-
time, the writes are then commited using the transaction-level write
557+
time, the writes committed using the transaction-level write
556558
concern.
557559

558560
.. tip::
559561

560-
Do not explicitly set the write concern for the individual write
562+
Don't explicitly set the write concern for the individual write
561563
operations inside a transaction. Setting write concerns for the
562-
individual write operations inside a transaction results in an error.
564+
individual write operations inside a transaction returns an error.
563565

564566
You can set the transaction-level :doc:`write concern
565567
</reference/write-concern>` at the transaction start:
@@ -612,9 +614,8 @@ values, including:
612614
`````````````````
613615

614616
- Write concern :writeconcern:`w: "majority" <"majority">` returns
615-
acknowledgement after the commit has been applied to a majority
616-
(M) of voting members, meaning the commit has been applied to the
617-
primary and (M-1) voting secondaries.
617+
acknowledgement after the commit has been applied to a majority of
618+
voting members.
618619

619620
- When you commit with :writeconcern:`w: "majority" <"majority">`
620621
write concern, transaction-level :readconcern:`"majority"` read
@@ -643,12 +644,15 @@ values, including:
643644
General Information
644645
-------------------
645646

647+
The following sections describe additional considerations for
648+
transactions.
649+
646650
Production Considerations
647651
~~~~~~~~~~~~~~~~~~~~~~~~~
648652

649-
For various production considerations with using transactions, see
653+
For transactions in production environments, see
650654
:ref:`production-considerations`. In addition, for sharded
651-
clusters, see also :ref:`production-considerations-sharded`.
655+
clusters, see :ref:`production-considerations-sharded`.
652656

653657
Arbiters
654658
~~~~~~~~
@@ -669,7 +673,7 @@ Shard Configuration Restriction
669673
Diagnostics
670674
~~~~~~~~~~~
671675

672-
MongoDB provides various transactions metrics:
676+
To obtain transaction status and metrics, use the following methods:
673677

674678
.. list-table::
675679
:widths: 40 60
@@ -710,9 +714,9 @@ MongoDB provides various transactions metrics:
710714

711715
* - :binary:`~bin.mongod` and :binary:`~bin.mongos` log messages
712716

713-
- Includes information on slow transactions, which are transactions
717+
- Includes information on slow transactions (which are transactions
714718
that exceed the :setting:`operationProfiling.slowOpThresholdMs`
715-
threshold) under the :data:`TXN` log component.
719+
threshold) in the :data:`TXN` log component.
716720

717721
.. _transactions-fcv:
718722

@@ -766,8 +770,8 @@ Starting in MongoDB 5.2 (and 5.0.4):
766770
:parameter:`metadataRefreshInTransactionMaxWaitBehindCritSecMS`
767771
parameter.
768772

769-
Additional Transactions Topics
770-
------------------------------
773+
Learn More
774+
----------
771775

772776
- :doc:`/core/transactions-in-applications`
773777
- :doc:`/core/transactions-production-consideration`

0 commit comments

Comments
 (0)