Skip to content

Commit a2b88ba

Browse files
author
Dave
authored
DOCS-14892 BACKPORT (#690)
1 parent ba58979 commit a2b88ba

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

source/reference/parameters.txt

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3024,6 +3024,57 @@ Sharding Parameters
30243024

30253025
`Live Migration Protocol <https://github.com/mongodb/mongo/blob/master/src/mongo/db/s/README.md#the-live-migration-protocol>`__
30263026

3027+
.. parameter:: metadataRefreshInTransactionMaxWaitBehindCritSecMS
3028+
3029+
.. versionadded:: 5.2 (*Also available starting in 5.1.0, 5.0.4*)
3030+
3031+
*Type*: integer
3032+
3033+
*Default*: 500
3034+
3035+
|mongod-only|
3036+
3037+
Limits the time a shard waits for a critical section within a
3038+
transaction.
3039+
3040+
When a query accesses a shard, a :ref:`chunk migration
3041+
<migrate-chunks-sharded-cluster>` or :ref:`DDL operation
3042+
<transactions-operations-ddl>` may already hold the critical
3043+
section for the collection. If the query finds the critical
3044+
section is taken, the shard waits until the critical section has
3045+
been released. When the shard returns control to :binary:`mongos`,
3046+
:binary:`mongos` retries the query. However, if a multi-shard
3047+
transaction interacts with an operation that takes the critical
3048+
section on multiple shards, the interaction can result in a
3049+
distributed deadlock.
3050+
3051+
3052+
:parameter:`metadataRefreshInTransactionMaxWaitBehindCritSecMS`
3053+
limits the maximum time a shard waits within a transaction for the
3054+
critical section to be released.
3055+
3056+
To reduce the maximum wait time for the critical section within a
3057+
transaction, lower the the value of
3058+
:parameter:`metadataRefreshInTransactionMaxWaitBehindCritSecMS`.
3059+
3060+
.. warning::
3061+
3062+
If :parameter:`metadataRefreshInTransactionMaxWaitBehindCritSecMS`
3063+
is too low, :binary:`mongos` could use all of its retry attempts
3064+
and return an error.
3065+
3066+
You can set
3067+
:parameter:`metadataRefreshInTransactionMaxWaitBehindCritSecMS` at
3068+
startup and during runtime.
3069+
3070+
For example, to set :parameter:`metadataRefreshInTransactionMaxWaitBehindCritSecMS`
3071+
to 400 milliseconds:
3072+
3073+
.. code-block:: javascript
3074+
3075+
db.adminCommand( { setParameter: 1, metadataRefreshInTransactionMaxWaitBehindCritSecMS: 400 } )
3076+
3077+
30273078
.. parameter:: readHedgingMode
30283079

30293080
.. versionadded:: 4.4

source/release-notes/5.2.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,15 @@ Starting in MongoDB 5.2, the :dbcommand:`setAllowMigrations` command:
197197
<sharding-chunk-migration-manual>` from committing
198198
- Excludes the collection from new balancer rounds
199199

200+
Limit Wait Time For Critical Section
201+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
202+
203+
Starting in MongoDB 5.2 (and 5.0.4, 5.1.0)
204+
205+
The :parameter:`metadataRefreshInTransactionMaxWaitBehindCritSecMS`
206+
parameter limits the time a shard waits for a critical section within a
207+
transaction.
208+
200209
.. _5.2-rel-notes-general:
201210

202211
General Improvements

0 commit comments

Comments
 (0)