@@ -2833,6 +2833,57 @@ Sharding Parameters
2833
2833
2834
2834
`Live Migration Protocol <https://github.com/mongodb/mongo/blob/master/src/mongo/db/s/README.md#the-live-migration-protocol>`__
2835
2835
2836
+ .. parameter:: metadataRefreshInTransactionMaxWaitBehindCritSecMS
2837
+
2838
+ .. versionadded:: 5.2 (*Also available starting in 5.1.0, 5.0.4*)
2839
+
2840
+ *Type*: integer
2841
+
2842
+ *Default*: 500
2843
+
2844
+ |mongod-only|
2845
+
2846
+ Limits the time a shard waits for a critical section within a
2847
+ transaction.
2848
+
2849
+ When a query accesses a shard, a :ref:`chunk migration
2850
+ <migrate-chunks-sharded-cluster>` or :ref:`DDL operation
2851
+ <transactions-operations-ddl>` may already hold the critical
2852
+ section for the collection. If the query finds the critical
2853
+ section is taken, the shard waits until the critical section has
2854
+ been released. When the shard returns control to :binary:`mongos`,
2855
+ :binary:`mongos` retries the query. However, if a multi-shard
2856
+ transaction interacts with an operation that takes the critical
2857
+ section on multiple shards, the interaction can result in a
2858
+ distributed deadlock.
2859
+
2860
+
2861
+ :parameter:`metadataRefreshInTransactionMaxWaitBehindCritSecMS`
2862
+ limits the maximum time a shard waits within a transaction for the
2863
+ critical section to be released.
2864
+
2865
+ To reduce the maximum wait time for the critical section within a
2866
+ transaction, lower the the value of
2867
+ :parameter:`metadataRefreshInTransactionMaxWaitBehindCritSecMS`.
2868
+
2869
+ .. warning::
2870
+
2871
+ If :parameter:`metadataRefreshInTransactionMaxWaitBehindCritSecMS`
2872
+ is too low, :binary:`mongos` could use all of its retry attempts
2873
+ and return an error.
2874
+
2875
+ You can set
2876
+ :parameter:`metadataRefreshInTransactionMaxWaitBehindCritSecMS` at
2877
+ startup and during runtime.
2878
+
2879
+ For example, to set :parameter:`metadataRefreshInTransactionMaxWaitBehindCritSecMS`
2880
+ to 400 milliseconds:
2881
+
2882
+ .. code-block:: javascript
2883
+
2884
+ db.adminCommand( { setParameter: 1, metadataRefreshInTransactionMaxWaitBehindCritSecMS: 400 } )
2885
+
2886
+
2836
2887
.. parameter:: readHedgingMode
2837
2888
2838
2889
.. versionadded:: 4.4
0 commit comments