Skip to content

Commit 378e086

Browse files
author
Dave Cuthbert
authored
DOCS-15751 insert delete with indexes (#2486)
* DOCS-15751-insert-delete-with-indexes * DOCS-15751-insert-delete-with-indexes * Staging fixes * Staging fixes * Staging fixes * Staging fixes * Review Feedback * Review feedback * Review feedback * Review feedback * Review feedback
1 parent 5b26a00 commit 378e086

File tree

6 files changed

+98
-75
lines changed

6 files changed

+98
-75
lines changed

source/core/transactions-in-applications.txt

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,13 @@ Callback API
4343
The callback API incorporates logic:
4444

4545
- To retry the transaction as a whole if the transaction encounters a
46-
:ref:`transient-transaction-error`.
46+
:ref:`transient-transaction-error` error.
4747

4848
- To retry the commit operation if the commit encounters an
49-
:ref:`unknown-transaction-commit-result`.
49+
:ref:`unknown-transaction-commit-result` error.
50+
51+
Starting in MongoDB 6.2, the server does not retry the transaction if
52+
it receives a :ref:`transactionTooLargeForCache-error` error.
5053

5154
Example
5255
~~~~~~~
@@ -373,8 +376,8 @@ transaction commits and incorporate retry logic for transactions.
373376

374377
.. _transient-transaction-error:
375378

376-
``"TransientTransactionError"``
377-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
379+
``TransientTransactionError``
380+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
378381

379382
The *individual* write operations inside the transaction are not
380383
retryable, regardless of the value of :urioption:`retryWrites`. If an
@@ -393,8 +396,8 @@ the transaction as a whole can be retried.
393396

394397
.. _unknown-transaction-commit-result:
395398

396-
``"UnknownTransactionCommitResult"``
397-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
399+
``UnknownTransactionCommitResult``
400+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
398401

399402
The commit operations are :doc:`retryable write operations
400403
</core/retryable-writes>`. If the commit operation encounters an error,
@@ -412,6 +415,27 @@ If the commit operation encounters an error labeled
412415
``"UnknownTransactionCommitResult"``, applications should explicitly
413416
incorporate retry logic for the error.
414417

418+
.. _transactionTooLargeForCache-error:
419+
420+
``TransactionTooLargeForCache``
421+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
422+
423+
.. versionadded:: 6.2
424+
425+
Starting in MongoDB 6.2, the server does not retry the transaction if
426+
it receives a ``TransactionTooLargeForCache`` error. This error means
427+
the cache is too small and a retry is likely to fail.
428+
429+
The default value for the
430+
:parameter:`transactionTooLargeForCacheThreshold` threshold is ``0.75``.
431+
The server returns ``TransactionTooLargeForCache`` instead of retrying
432+
the transaction when the transaction uses more than 75% of the cache.
433+
434+
In earlier versions of MongoDB, the server returns
435+
``TemporarilyUnavailable`` or ``WriteConflict`` instead of
436+
``TransactionTooLargeForCache``.
437+
438+
Use the :dbcommand:`setParameter` command to modify the error threshold.
415439

416440
Driver Version Errors
417441
~~~~~~~~~~~~~~~~~~~~~

source/core/transactions.txt

Lines changed: 12 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,14 @@ upper-right to set the language of the following example.
4242

4343
----------
4444

45-
This example highlights the key components of the transactions API.
46-
4745
.. tabs-selector:: drivers
4846

4947
.. tabs-drivers::
5048

5149
.. tab::
5250
:tabid: python
5351

54-
The example uses the new callback API for working with
55-
transactions, which starts a transaction, executes the
56-
specified operations, and commits (or aborts on error). The
57-
new callback API also incorporates retry logic for
58-
``TransientTransactionError`` or
59-
``UnknownTransactionCommitResult`` commit errors.
52+
.. include:: /includes/transactions/example-intro.rst
6053

6154
.. include:: /includes/extracts/transactions-example-note.rst
6255

@@ -69,12 +62,7 @@ This example highlights the key components of the transactions API.
6962
.. tab::
7063
:tabid: java-sync
7164

72-
The example uses the new callback API for working with
73-
transactions, which starts a transaction, executes the
74-
specified operations, and commits (or aborts on error). The
75-
new callback API also incorporates retry logic for
76-
``TransientTransactionError`` or
77-
``UnknownTransactionCommitResult`` commit errors.
65+
.. include:: /includes/transactions/example-intro.rst
7866

7967
.. include:: /includes/extracts/transactions-example-note.rst
8068

@@ -141,12 +129,7 @@ This example highlights the key components of the transactions API.
141129
.. tab::
142130
:tabid: nodejs
143131

144-
The example uses the new callback API for working with
145-
transactions, which starts a transaction, executes the
146-
specified operations, and commits (or aborts on error). The
147-
new callback API also incorporates retry logic for
148-
``TransientTransactionError`` or
149-
``UnknownTransactionCommitResult`` commit errors.
132+
.. include:: /includes/transactions/example-intro.rst
150133

151134
.. include:: /includes/extracts/transactions-example-note.rst
152135

@@ -159,12 +142,7 @@ This example highlights the key components of the transactions API.
159142
.. tab::
160143
:tabid: php
161144

162-
The example uses the new callback API for working with
163-
transactions, which starts a transaction, executes the
164-
specified operations, and commits (or aborts on error). The
165-
new callback API also incorporates retry logic for
166-
``TransientTransactionError`` or
167-
``UnknownTransactionCommitResult`` commit errors.
145+
.. include:: /includes/transactions/example-intro.rst
168146

169147
.. include:: /includes/extracts/transactions-example-note.rst
170148

@@ -177,12 +155,7 @@ This example highlights the key components of the transactions API.
177155
.. tab::
178156
:tabid: csharp
179157

180-
The example uses the new callback API for working with
181-
transactions, which starts a transaction, executes the
182-
specified operations, and commits (or aborts on error). The
183-
new callback API also incorporates retry logic for
184-
``TransientTransactionError`` or
185-
``UnknownTransactionCommitResult`` commit errors.
158+
.. include:: /includes/transactions/example-intro.rst
186159

187160
.. include:: /includes/extracts/transactions-example-note.rst
188161

@@ -195,12 +168,7 @@ This example highlights the key components of the transactions API.
195168
.. tab::
196169
:tabid: c
197170

198-
The example uses the new callback API for working with
199-
transactions, which starts a transaction, executes the
200-
specified operations, and commits (or aborts on error). The
201-
new callback API also incorporates retry logic for
202-
``TransientTransactionError`` or
203-
``UnknownTransactionCommitResult`` commit errors.
171+
.. include:: /includes/transactions/example-intro.rst
204172

205173
.. include:: /includes/extracts/transactions-example-note.rst
206174

@@ -212,12 +180,7 @@ This example highlights the key components of the transactions API.
212180
.. tab::
213181
:tabid: cpp
214182

215-
The example uses the new callback API for working with
216-
transactions, which starts a transaction, executes the
217-
specified operations, and commits (or aborts on error). The
218-
new callback API also incorporates retry logic for
219-
``TransientTransactionError`` or
220-
``UnknownTransactionCommitResult`` commit errors.
183+
.. include:: /includes/transactions/example-intro.rst
221184

222185
.. include:: /includes/extracts/transactions-example-note.rst
223186

@@ -230,12 +193,7 @@ This example highlights the key components of the transactions API.
230193
.. tab::
231194
:tabid: motor
232195

233-
The example uses the new callback API for working with
234-
transactions, which starts a transaction, executes the
235-
specified operations, and commits (or aborts on error). The
236-
new callback API incorporates retry logic for
237-
:ref:`transient-transaction-error` or
238-
:ref:`unknown-transaction-commit-result` commit errors.
196+
.. include:: /includes/transactions/example-intro.rst
239197

240198
.. include:: /includes/extracts/transactions-example-note.rst
241199

@@ -248,12 +206,7 @@ This example highlights the key components of the transactions API.
248206
.. tab::
249207
:tabid: ruby
250208

251-
The example uses the new callback API for working with
252-
transactions, which starts a transaction, executes the
253-
specified operations, and commits (or aborts on error). The
254-
new callback API incorporates retry logic for
255-
:ref:`transient-transaction-error` or
256-
:ref:`unknown-transaction-commit-result` commit errors.
209+
.. include:: /includes/transactions/example-intro.rst
257210

258211
.. include:: /includes/extracts/transactions-example-note.rst
259212

@@ -267,12 +220,7 @@ This example highlights the key components of the transactions API.
267220
.. tab::
268221
:tabid: go
269222

270-
The example uses the new callback API for working with
271-
transactions, which starts a transaction, executes the
272-
specified operations, and commits (or aborts on error). The
273-
new callback API incorporates retry logic for
274-
:ref:`transient-transaction-error` or
275-
:ref:`unknown-transaction-commit-result` commit errors.
223+
.. include:: /includes/transactions/example-intro.rst
276224

277225
.. include:: /includes/extracts/transactions-example-note.rst
278226

@@ -284,12 +232,7 @@ This example highlights the key components of the transactions API.
284232
.. tab::
285233
:tabid: perl
286234

287-
This example uses the :ref:`core API <txn-core-api>`. Because the
288-
core API does not incorporate retry logic for
289-
:ref:`transient-transaction-error` or
290-
:ref:`unknown-transaction-commit-result` commit errors, the
291-
example includes explicit logic to retry the transaction for these
292-
errors:
235+
.. include:: /includes/transactions/example-intro.rst
293236

294237
.. include:: /includes/extracts/transactions-example-note.rst
295238

@@ -302,7 +245,7 @@ This example highlights the key components of the transactions API.
302245
:tabid: scala
303246

304247
This example uses the :ref:`core API <txn-core-api>`. Because the
305-
core API does not incorporate retry logic for
248+
core API does not incorporate retry logic for the
306249
:ref:`transient-transaction-error` or
307250
:ref:`unknown-transaction-commit-result` commit errors, the
308251
example includes explicit logic to retry the transaction for
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
This example highlights the key components of the transactions API. In
2+
particular, it uses the callback API. The callback API:
3+
4+
- starts a transaction
5+
- executes the specified operations
6+
- commits the result (or aborts on error)
7+
8+
The callback API incorporates retry logic for certain errors. The server
9+
tries to rerun the transaction after a :ref:`TransientTransactionError
10+
<transient-transaction-error>` or :ref:`UnknownTransactionCommitResult
11+
<unknown-transaction-commit-result>` commit error.
12+
13+
Starting in MongoDB 6.2, the server does not retry the transaction if
14+
it receives a :ref:`TransactionTooLargeForCache
15+
<transactionTooLargeForCache-error>` error.
16+

source/reference/configuration-options.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3973,6 +3973,8 @@ LDAP Parameters
39733973
:setting:`~storage.oplogMinRetentionHours`.
39743974

39753975

3976+
.. _wiredTiger-storage-options:
3977+
39763978
``storage.wiredTiger`` Options
39773979
``````````````````````````````
39783980

source/reference/parameters.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4944,7 +4944,39 @@ Transaction Parameters
49444944
modified for all shard replica set members.
49454945

49464946
.. include:: /includes/transactionLifetimeLimitSeconds-parameter.rst
4947+
4948+
.. parameter:: transactionTooLargeForCacheThreshold
4949+
4950+
.. versionadded:: 6.2
4951+
4952+
|mongod-only|
4953+
4954+
*Type*: decimal
4955+
4956+
*Default*: 0.75
4957+
4958+
The threshold value for retrying transactions that fail due to cache
4959+
pressure. The value is a percentage of the dirty cache size. The
4960+
default value, ``0.75``, means 75% of the dirty cache.
4961+
4962+
The dirty cache is limited to 20% of the total cache size. When
4963+
``transactionTooLargeForCacheThreshold`` is set to ``0.75``, the
4964+
server only retries transactions that use less than 15%
4965+
(``0.75 * 20%``) of the total storage engine cache.
49474966

4967+
The limit only applies to retries. Large transactions can use more
4968+
than ``transactionTooLargeForCacheThreshold`` percent of the dirty
4969+
cache. However, if a large transaction is rolled back due to cache
4970+
pressure, the server issues a
4971+
:ref:`transactionTooLargeForCache-error` error and does not retry the
4972+
transaction.
4973+
4974+
To disable this behavior, set
4975+
``transactionTooLargeForCacheThreshold`` to ``1.0``.
4976+
4977+
For more information on WiredTiger storage, see:
4978+
:ref:`wiredTiger-storage-options`.
4979+
49484980
.. parameter:: maxTransactionLockRequestTimeoutMillis
49494981

49504982
.. versionadded:: 4.0

source/release-notes/6.2.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ instances. Latencies reported by ``mongos`` include operation latency
5050
time and communication time between the ``mongod`` and ``mongos``
5151
instances.
5252

53+
Server Parameters
54+
~~~~~~~~~~~~~~~~~
55+
56+
Starting in MongoDB 6.2, :binary:`mongod` adds these parameters:
57+
58+
- :parameter:`transactionTooLargeForCacheThreshold`
5359

5460
Deprecated Commands
5561
~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)