[SERVER-36231] Mongos write path doesn't look for retryable write concern errors Created: 20/Jul/18  Updated: 29/Oct/23  Resolved: 25/Jan/19

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 3.6.12, 4.0.7, 4.1.8

Type: Bug Priority: Major - P3
Reporter: Jack Mulrow Assignee: Randolph Tan
Resolution: Fixed Votes: 0
Labels: sharding-wfbf-day
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.0, v3.6
Sprint: Sharding 2019-01-28, Sharding 2019-02-11
Participants:
Linked BF Score: 12

 Description   

If a node steps down while waiting for write concern, it can return a PrimarySteppedDown error code in the WriteConcernError field in its command response. PrimarySteppedDown is treated as a retryable error in the AsyncRequestsSender (for the kIdempotent retry policy), but the ARS doesn't look for retryable errors in the WriteConcernError field.

This means that retryable writes (writes with a txnNumber) won't automatically be retried by mongos if a failover led to a write concern error, because they rely on the ARS to retry them. The replica set monitor for the targeted shard should also be updated, since if there was a retry attempt, it would target the old primary.

For reference, ShardRemote::_runCommand does inspect write concern errors and update the replica set monitor for them.



 Comments   
Comment by Githook User [ 05/Mar/19 ]

Author:

{'name': 'Randolph Tan', 'email': 'randolph@10gen.com', 'username': 'renctan'}

Message: SERVER-36231 Mongos write path doesn't look for retryable write concern errors

(cherry picked from commit 9df4dbcffefe8f9cf2d669603f230c1f44ac5652)
Branch: v3.6
https://github.com/mongodb/mongo/commit/a4762a9723fd6955cc07d673911840d3527edc5a

Comment by Githook User [ 21/Feb/19 ]

Author:

{'name': 'Randolph Tan', 'username': 'renctan', 'email': 'randolph@10gen.com'}

Message: SERVER-36231 Mongos write path doesn't look for retryable write concern errors

(cherry picked from commit 9df4dbcffefe8f9cf2d669603f230c1f44ac5652)
Branch: v4.0
https://github.com/mongodb/mongo/commit/89f1160cc1d5ebd6401485ad13aa1973666e8133

Comment by Kaloian Manassiev [ 25/Jan/19 ]

renctan, there is a commit here - should this be closed now? See also Kelsey's question about backporting.

Comment by Githook User [ 16/Jan/19 ]

Author:

{'username': 'renctan', 'email': 'randolph@10gen.com', 'name': 'Randolph Tan'}

Message: SERVER-36231 Mongos write path doesn't look for retryable write concern errors
Branch: master
https://github.com/mongodb/mongo/commit/9df4dbcffefe8f9cf2d669603f230c1f44ac5652

Generated at Thu Feb 08 04:42:28 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.