Operational Defect Database

BugZero found this defect 81 days ago.

MongoDB | 2592358

findAndModify might miss document on update without shard key

Last update date:

3/13/2024

Affected products:

MongoDB Server

Affected releases:

No affected releases provided.

Fixed releases:

No fixed releases provided.

Description:

Info

PM-1632 added the possibility to run an update without a shard key in sharded clusters with all options. As part of the project SERVER-76530 added an optimization for findAndModify, trying to not go through the protocol if all the chunks are owned by a single shard. the collection has a single chunk. However, the following scenario might happen: A transaction with snapshot read concern starts and performs a write to a collection at time T1. This effectively sets the atClusterTime of the entire transaction to T1. A moveChunk happens, changing the placement for collection2 at time T2. A findAndModify for collection2 is issued, the said optimization for PM-1632 will try to target the destination shard of the migration, with the correct shard version, but with the wrong clusterTime (T1), This will cause the findAndModify to not find the document. You can find the repro attached. Until we can safely use the optimization, we could simply target using the default path.

Top User Comments


Steps to Reproduce

Run the attached repro

Additional Resources / Links

Share:

BugZero® Risk Score

What's this?

Coming soon

Status

In Progress

Learn More

Search:

...