[SERVER-22178] Should retry a sorted findAndModify if conflicts are detected (non-MMAP only) Created: 13/Jan/16  Updated: 02/Oct/17  Resolved: 31/Mar/16

Status: Closed
Project: Core Server
Component/s: Concurrency, Querying
Affects Version/s: 3.2.1
Fix Version/s: 3.3.4

Type: Bug Priority: Major - P3
Reporter: Charlie Swanson Assignee: Charlie Swanson
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
is duplicated by SERVER-31288 findAndModify using a sorting will fa... Closed
Related
related to SERVER-23925 Potential use-after-free when WSM is ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Query F (02/01/16), Query 10 (02/22/16), Query 11 (03/14/16), Query 12 (04/04/16)
Participants:
Linked BF Score: 0

 Description   

In the delete stage, we check to see if the document we're about to delete still exists, and still matches the query predicate (code here). If it no longer exists/matches, we skip it. This is undesirable during a sorted findAndModify, because if we are doing an in-memory sort, it will have a limit of 1, so skipping will effectively mean returning null (even if there may have been other matches).

A similar problem exists in the update stage.



 Comments   
Comment by Githook User [ 31/Mar/16 ]

Author:

{u'username': u'cswanson310', u'name': u'Charlie Swanson', u'email': u'cswanson310@gmail.com'}

Message: SERVER-22178 Fix tests on ephemeralForTest storage engine.

Also update comments on other concurrency tests.
Branch: master
https://github.com/mongodb/mongo/commit/30de40a496863289da21aa7185d16000e5ca38c1

Comment by Charlie Swanson [ 28/Mar/16 ]

Reopening to fix BF-2094

Comment by Githook User [ 25/Mar/16 ]

Author:

{u'username': u'cswanson310', u'name': u'Charlie Swanson', u'email': u'charlie.swanson@mongodb.com'}

Message: SERVER-22178 Move calls that cannot throw out of try/catch block.

WorkingSetCommon::prepareForSnapshotChange shouldn't ever throw an
exception, so it should be removed from the try/catch blocks in the
delete and update stages.
Branch: master
https://github.com/mongodb/mongo/commit/785267c6c379bd712f8b881f6c38dc1e83fc3881

Comment by Githook User [ 25/Mar/16 ]

Author:

{u'username': u'cswanson310', u'name': u'Charlie Swanson', u'email': u'charlie.swanson@mongodb.com'}

Message: SERVER-22178 Always retry sorted findAndModify upon write conflict.

Previously, if there was a WriteConflictException while actually doing
the update or delete, we would retry the findAndModify, but if the
update or delete stage detected that the document was already deleted
or that it no longer matched the predicate, it would not retry. This
patch ensures the findAndModify will be retried in either of those
scenarios.
Branch: master
https://github.com/mongodb/mongo/commit/178e241b81882f85a58deda960d80607a77e1c3a

Generated at Thu Feb 08 03:59:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.