[SERVER-53966] Allow specifying maxTransactionLockRequestTimeoutMillis per-transaction Created: 22/Jan/21  Updated: 27/Oct/23  Resolved: 02/Nov/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Johnny Shields Assignee: Judah Schvimer
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

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

5ms is quite low for my use case, I'm getting frequent WriteConflict errors I'd like to make it larger. My feedback here:

  1. 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
  2. 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)?
  3. 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.
  4. If you set maxTransactionLockRequestTimeoutMillis to -1, does it still use 5ms as a default? Or 0? or Infinity?

 



 Comments   
Comment by Judah Schvimer [ 31/Oct/22 ]

Hi!

Thank you for this report and I'm sorry for the very long delay, this seems to have gotten lost in our backlog.

In the description, it says you are receiving WriteConflict errors. WriteConflicts in MongoDB are caused by concurrent conflicting document writes. This is done to ensure we provide snapshot isolation transactions. If a lock acquisition times out (locks are only acquired at the collection, database, and global levels), you'll receive a LockTimeout error. If you get a WriteConflict, there is no amount of time you could wait for the conflict to resolve, you must abort the transaction and restart with a new storage engine snapshot.

Does this answer your question? If so, I will close this ticket as "Works as Designed".

Comment by Johnny Shields [ 20/Aug/21 ]

Yes please, thank you for following up on this.

Comment by Gaurav Kumar (Inactive) [ 10/May/21 ]

We will investigate this, and get back to you. the main questions to answer:

Clarify:

1. 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.
2. If you set maxTransactionLockRequestTimeoutMillis to -1, does it still use 5ms as a default? Or 0? or Infinity?

3. 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

Comment by Eric Sedor [ 27/Jan/21 ]

Hi shields@tablecheck.com,

Some of these questions may be more appropriate for the MongoDB Developer Community Forums, but I am passing this to an appropriate team to consider your request to allow specifying maxTransactionLockRequestTimeoutMillis at a transaction level, and to obtain clarity on the operation-specific timeout documentation.

Thanks,
Eric

Generated at Thu Feb 08 05:32:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.