[SERVER-27067] Some Commands do not wait for write concern for no-op writes Created: 16/Nov/16 Updated: 20/Dec/23 Resolved: 26/Jul/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Replication |
| Affects Version/s: | 3.4.0-rc3 |
| Fix Version/s: | 3.4.11, 3.5.11 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Randolph Tan | Assignee: | Judah Schvimer |
| Resolution: | Done | Votes: | 0 |
| Labels: | bkp, writeconcern | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||||||||||||||
| Backport Requested: |
v3.4, v3.2
|
||||||||||||||||||||||||||||||||||||||||
| Sprint: | Repl 2017-01-23, Repl 2017-02-13, Repl 2017-04-17, Repl 2017-05-08, Repl 2017-05-29, Repl 2017-07-31 | ||||||||||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||||||||||
| Linked BF Score: | 0 | ||||||||||||||||||||||||||||||||||||||||
| Description |
|
The wait for write concern code returns early if the ReplClientInfo is not set: https://github.com/mongodb/mongo/blob/r3.4.0-rc3/src/mongo/db/write_concern.cpp#L223-L226 This means that if certain commands that does write actually ends up as no-op, it will actually not end up waiting for write concern. Example case:
Some of the commands already wait for write concern correctly even though it ends up doing a no-op write via repl::ReplClientInfo::setLastOpToSystemLastOpTime (for example, findAndModify, write commands, applyOps, etc). |
| Comments |
| Comment by Githook User [ 30/Nov/17 ] |
|
Author: {'name': 'Judah Schvimer', 'username': 'judahschvimer', 'email': 'judah@mongodb.com'}Message: (cherry picked from commit 50cbe6d35a3b61ce674eb0d8fae173f70f1dddd5) |
| Comment by Githook User [ 30/Nov/17 ] |
|
Author: {'name': 'Judah Schvimer', 'username': 'judahschvimer', 'email': 'judah@mongodb.com'}Message: |
| Comment by Githook User [ 30/Nov/17 ] |
|
Author: {'name': 'Judah Schvimer', 'username': 'judahschvimer', 'email': 'judah@mongodb.com'}Message: (cherry picked from commit 5dda752d6cc8ed1f75a564b03b7357592f488d93) |
| Comment by Githook User [ 26/Jul/17 ] |
|
Author: {'email': 'judah@mongodb.com', 'username': 'judahschvimer', 'name': 'Judah Schvimer'}Message: |
| Comment by Githook User [ 17/Jul/17 ] |
|
Author: {u'username': u'judahschvimer', u'name': u'Judah Schvimer', u'email': u'judah@mongodb.com'}Message: |
| Comment by Githook User [ 29/Jun/17 ] |
|
Author: {u'username': u'judahschvimer', u'name': u'Judah Schvimer', u'email': u'judah@mongodb.com'}Message: |
| Comment by Spencer Brody (Inactive) [ 08/Jun/17 ] |
|
Current implementation plan:
Note that this solution won't automatically handle the case where a single command does multiple writes and the last one is a no-op. In that case we could wind up not waiting long enough to include the no-op write. The only case where this can happen currently though is in multi-writes in the batch write commands, which already have special logic to handle this case. |