[SERVER-43337] handle errors that occur on the shard when findAndModify is converted to a transaction. Created: 13/Sep/19  Updated: 29/Oct/23  Resolved: 20/Sep/19

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 4.3.1, 4.2.2

Type: Bug Priority: Minor - P4
Reporter: Lamont Nelson Assignee: Janna Golden
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.2
Steps To Reproduce:

See BF-13801 comments.

Sprint: Sharding 2019-09-23
Participants:
Linked BF Score: 15

 Description   

The findAndModify command tries to commit even after there is an error on one of the shards.

From the BF Comments:

Our theory is that the there is a failure after the findAndModify is converted into a transaction here: https://github.com/mongodb/mongo/blob/master/src/mongo/s/commands/cluster_find_and_modify_cmd.cpp#L323. The recursive invocation of _runCommand only throws an error if response.status is ok or if the response.data has an error that is is in

{NeedRetargettingError, SnapshotError, ErrorCodes::StaleDbVersion}

. So the command will try to commit if it's not one of these.



 Comments   
Comment by Githook User [ 15/Nov/19 ]

Author:

{'username': 'jannaerin', 'email': 'janna.golden@mongodb.com', 'name': 'Janna Golden'}

Message: SERVER-43337 Check that txn writes are successful before attempting to commit an update to shard key

(cherry picked from commit b21c2f2741682591b925841aea131bc3dce3de9a)
Branch: v4.2
https://github.com/mongodb/mongo/commit/057cbc36a1fde617f8b5047a1c1a146b33214b92

Comment by Githook User [ 20/Sep/19 ]

Author:

{'name': 'Janna Golden', 'username': 'jannaerin', 'email': 'janna.golden@mongodb.com'}

Message: SERVER-43337 Check that txn writes are successful before attempting to commit an update to shard key
Branch: master
https://github.com/mongodb/mongo/commit/b21c2f2741682591b925841aea131bc3dce3de9a

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