-
Type: Improvement
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
When using Transactions, it is useful to control write timeouts avoid WriteConflict errors.
From the MongoDB docs: https://docs.mongodb.com/manual/reference/parameters/#param.maxTransactionLockRequestTimeoutMillis
- "By default, multi-document transactions wait 5 milliseconds.... If an operation provides a greater timeout in a lock request, maxTransactionLockRequestTimeoutMillis overrides the operation-specific timeout."
- "-1 to use the operation specific timeout."
5ms is quite low for my use case, I'm getting frequent WriteConflict errors I'd like to make it larger. My feedback here:
- It is not clear to me how to set operation specific timeout. It appears would use maxTimeMs or wtimeout , however many write operations such as "update" do not support this parameter. https://docs.mongodb.com/manual/reference/method/db.collection.update/index.html
- It would be nice to be able to set this parameter at the transaction level. Perhaps that would need to be done in the driver (and passed down to the individual operations)?
- The docs imply that even if you set an operation specific timeout, unless you've set maxTransactionLockRequestTimeoutMillis to -1, the max timeout will still be 5ms.
- If you set maxTransactionLockRequestTimeoutMillis to -1, does it still use 5ms as a default? Or 0? or Infinity?