Skip to content

Commit 2539e4c

Browse files
jason-price-mongodbandf-mongodb
authored andcommitted
DOCS-13283 Two phase commit use lower write concern
1 parent 652e54b commit 2539e4c

File tree

5 files changed

+62
-9
lines changed

5 files changed

+62
-9
lines changed

source/core/transactions.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,11 +698,12 @@ values, including:
698698
concern guarantees that operations have from a synchronized
699699
snapshot of majority-committed data.
700700

701-
702701
.. note::
703702

704703
.. include:: /includes/extracts/transactions-sharded-clusters-commit-writeconcern.rst
705-
704+
705+
.. include:: /includes/return-commit-decision-parameter.rst
706+
706707
General Information
707708
-------------------
708709

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Starting in MongoDB 5.0, the new server parameter
2+
:parameter:`coordinateCommitReturnImmediatelyAfterPersistingDecision`
3+
controls when transaction commit decisions are returned to the client.
4+
In previous versions of MongoDB, the :doc:`shard
5+
</core/sharded-cluster-shards>` transaction coordinator waited for all
6+
members to acknowledge a :ref:`multi-document transaction
7+
<transactions-atomicity>` commit before returning the commit decision to
8+
the client.

source/reference/command/commitTransaction.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,21 @@ Definition
3737
writeConcern: <document>,
3838
autocommit: false,
3939
comment: <any>
40-
}
40+
}
4141

4242
Behavior
4343
--------
4444

4545
Write Concern
4646
~~~~~~~~~~~~~
4747

48-
When committing the transaction, the session uses the write concern
49-
specified at the transaction start. See
50-
:method:`Session.startTransaction()`.
48+
When committing the transaction, the session uses the :doc:`write
49+
concern </reference/write-concern>` specified at the transaction start.
50+
See :method:`Session.startTransaction()`.
5151

52-
If you commit using :writeconcern:`"w: 1" <\<number\>>` write concern,
53-
your transaction can be :doc:`rolled back if there is a failover.
54-
</core/replica-set-rollbacks>`.
52+
If you commit using the :writeconcern:`"w: 1" <\<number\>>` write
53+
concern, your transaction can be :doc:`rolled back if there is a
54+
failover. </core/replica-set-rollbacks>`.
5555

5656
Atomicity
5757
~~~~~~~~~

source/reference/parameters.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3622,6 +3622,45 @@ Auditing Parameters
36223622
Transaction Parameters
36233623
~~~~~~~~~~~~~~~~~~~~~~
36243624

3625+
.. parameter:: coordinateCommitReturnImmediatelyAfterPersistingDecision
3626+
3627+
.. versionadded:: 5.0
3628+
3629+
*Type*: boolean
3630+
3631+
*Default*: true
3632+
3633+
|mongod-only|
3634+
3635+
If ``true``, the :doc:`shard </core/sharded-cluster-shards>`
3636+
transaction coordinator returns a :ref:`multi-document transaction
3637+
<transactions-atomicity>` commit decision to the client as soon as
3638+
the commit is made :term:`durable` with the requested transaction
3639+
:doc:`write concern </reference/write-concern>`. If the client
3640+
requested a write concern that is less than
3641+
:writeconcern:`"majority"`, the commit may roll back after the
3642+
decision is returned to the client.
3643+
3644+
If ``false``, the :doc:`shard </core/sharded-cluster-shards>`
3645+
transaction coordinator waits for all members to acknowledge a
3646+
:ref:`multi-document transaction <transactions-atomicity>` commit
3647+
before returning the commit decision to the client.
3648+
3649+
The following example sets
3650+
:parameter:`coordinateCommitReturnImmediatelyAfterPersistingDecision`
3651+
to ``false``:
3652+
3653+
.. code-block:: javascript
3654+
3655+
mongod --setParameter coordinateCommitReturnImmediatelyAfterPersistingDecision=false
3656+
3657+
During runtime, you can also set the parameter with the
3658+
:dbcommand:`setParameter` command:
3659+
3660+
.. code-block:: sh
3661+
3662+
db.adminCommand( { setParameter: 1, coordinateCommitReturnImmediatelyAfterPersistingDecision: false } )
3663+
36253664
.. parameter:: transactionLifetimeLimitSeconds
36263665

36273666
.. versionadded:: 4.0

source/release-notes/5.0.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ Starting in MongoDB 5.0, :ref:`change-events`
8585
contain the field ``updateDescription.truncatedArrays`` to record array
8686
truncations.
8787

88+
``coordinateCommitReturnImmediatelyAfterPersistingDecision`` Parameter
89+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
90+
91+
.. include:: /includes/return-commit-decision-parameter.rst
92+
8893
.. _5.0-rel-notes-security:
8994

9095
Security Improvements

0 commit comments

Comments
 (0)