[SERVER-25765] Commands should wait for write concern even if they throw an exception Created: 23/Aug/16  Updated: 11/Jan/22  Resolved: 20/Apr/17

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 3.4.6, 3.5.7

Type: Bug Priority: Major - P3
Reporter: Spencer Brody (Inactive) Assignee: Spencer Brody (Inactive)
Resolution: Done Votes: 0
Labels: writeconcern
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
is related to SERVER-27067 Some Commands do not wait for write c... Closed
is related to SERVER-34679 Write concern errors are lost when co... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.4, v3.2
Sprint: Repl 2017-02-13, Repl 2017-04-17, Repl 2017-05-08
Participants:

 Description   

Discovered while working on SERVER-25001.

Even when a command fails or results in a no-op, if that failure was due to the state of the data files at that moment, and the command came with a w:majority write concern, we need to wait for the most recent optime to become committed, so that the data that caused the command to error will be visible on a subsequent majority read. We already do this properly when a command returns a failure by returning false, but if the command throws an exception we don't. This can lead to subtle problems with the maintenance of the config server optime, as well as leading to confusing behavior for users using readConcern:majority reads



 Comments   
Comment by Githook User [ 16/Jun/17 ]

Author:

{u'username': u'stbrody', u'name': u'Spencer T Brody', u'email': u'spencer@mongodb.com'}

Message: SERVER-25765 Commands should wait for write concern even if they throw an exception

(cherry picked from commit 5bdd2f49c02e5fe2812ccc6f21502799fa5a3268)
Branch: v3.4
https://github.com/mongodb/mongo/commit/471020b727192e4067a27bcae29db21a59901568

Comment by Githook User [ 20/Apr/17 ]

Author:

{u'username': u'stbrody', u'name': u'Spencer T Brody', u'email': u'spencer@mongodb.com'}

Message: SERVER-25765 Commands should wait for write concern even if they throw an exception
Branch: master
https://github.com/mongodb/mongo/commit/5bdd2f49c02e5fe2812ccc6f21502799fa5a3268

Comment by Spencer Brody (Inactive) [ 23/Aug/16 ]

I think this should be as straightforward as moving the waiting for write concern code to be in an ON_BLOCK_EXIT set up right before running the command.

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