[SERVER-77616] findOneAndUpdate with no-op update does not seem to work against stale reads Created: 31/May/23  Updated: 08/Jan/24

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

Type: Bug Priority: Major - P3
Reporter: Peter Ivanov Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: documentation, transactions
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Triage
Operating System: ALL
Steps To Reproduce:

There's no code snippet at this point, but the idea is:

  1. Start 2 transactions with [write: majority, read: primary, snapshot, causal consistency: true]
  2. Make each of them "read" one document using "fake" findOneAndUpdate
  3. Make each of them update the document another transaction has just "read"
  4. No write conflict happens

And if we change the step 2 so that findOneAndUpdate actually changes the document, step 4 works as intended, and one of the transactions fails. 

Participants:

 Description   

The's this part of a documentation:

https://www.mongodb.com/docs/manual/core/transactions-production-consideration/#in-progress-transactions-and-stale-reads

However, when we tried to use this trick, it only proved to be working as intended if the update actually changes something in the document.

Otherwise, despite being used exactly as in the example, such operation did not, in the test scenario, trigger a write conflict that would trigger a retry for a transaction.

 

Could some other factors be relevant which are absent from the documentation? I'm willing to provide as full a context as I can.


Generated at Thu Feb 08 06:36:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.