Skip to content

Commit

Permalink
DRIVERS-1150 Writes are not retried within transactions (#1481)
Browse files Browse the repository at this point in the history
Co-authored-by: Kyle Kloberdanz <kyle.kloberdanz@mongodb.com>
Co-authored-by: Isabel Atkinson <isabelatkinson@gmail.com>
  • Loading branch information
3 people authored Dec 19, 2023
1 parent 0b47194 commit 1c40a03
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions source/retryable-writes/retryable-writes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,18 @@ response.
.. _findAndModify: https://www.mongodb.com/docs/manual/reference/command/findAndModify/
.. _aggregate: https://www.mongodb.com/docs/manual/reference/command/aggregate/

Retryable Writes Within Transactions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In MongoDB 4.0 the only supported retryable write commands within a transaction
are ``commitTransaction`` and ``abortTransaction``. Therefore drivers MUST NOT
retry write commands within transactions even when ``retryWrites`` has been
set to true on the ``MongoClient``. In addition, drivers MUST NOT add
the ``RetryableWriteError`` label to any error that occurs during a write
command within a transaction (excepting ``commitTransation``
and ``abortTransaction``), even when ``retryWrites`` has been set to true on
the ``MongoClient``.

Implementing Retryable Writes
-----------------------------

Expand Down Expand Up @@ -838,6 +850,7 @@ inconsistent with the server and potentially confusing to developers.
Changelog
=========

:2023-12-06: Clarify that writes are not retried within transactions.
:2023-10-02: When CSOT is not enabled, one retry attempt occurs.
:2023-08-26: Require that in a sharded cluster the server on which the
operation failed MUST be provided to the server selection
Expand Down

0 comments on commit 1c40a03

Please sign in to comment.