@@ -3024,6 +3024,57 @@ Sharding Parameters
3024
3024
3025
3025
`Live Migration Protocol <https://github.com/mongodb/mongo/blob/master/src/mongo/db/s/README.md#the-live-migration-protocol>`__
3026
3026
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
+
3027
3078
.. parameter:: readHedgingMode
3028
3079
3029
3080
.. versionadded:: 4.4
0 commit comments