Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRIVERS-1150 Writes are not retried within transactions #1481

Merged
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
Loading