[SERVER-29693] "lastAppliedOpTime" value can sometimes be set to an optime ahead of uncommitted operations Created: 16/Jun/17  Updated: 30/Oct/23  Resolved: 22/Aug/17

Status: Closed
Project: Core Server
Component/s: Replication, Storage
Affects Version/s: None
Fix Version/s: 3.5.13

Type: Bug Priority: Major - P3
Reporter: Eric Milkie Assignee: Eric Milkie
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-29539 Visibility issues for readAfterCluste... Closed
Problem/Incident
Related
is related to SERVER-28150 Add support for readConcern::afterClu... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Storage 2017-08-21, Storage 2017-09-11
Participants:
Linked BF Score: 16

 Description   

Currently, a PRIMARY node updates its lastAppliedOpTime value whenever any write operation commits: https://github.com/mongodb/mongo/blob/8ec35cb932d07eb034beee2b1938800675fb3c0c/src/mongo/db/repl/oplog.cpp#L373

On document-level-locking storage engines, writes can commit out of optime order. This means that the use of lastAppliedOpTime to determine when it is safe to allow reads is not providing an assumed guarantee: that all operations prior to the lastAppliedOpTime will be visible.
In 3.4, the only operation that could run afoul of this is a read operation with readConcern: { level: "local", afterOpTime: xxxx } (or afterOpTime with level majority in a one-voting-node replica set), but such operations are currently disallowed. Thus, this bug is hidden from normal operation.
In a future release, we expect that this guarantee will be critical for the correct operation of read operations with read concerns utilizing "afterClusterTime".



 Comments   
Comment by Githook User [ 22/Aug/17 ]

Author:

{'username': 'milkie', 'email': 'milkie@10gen.com', 'name': 'Eric Milkie'}

Message: SERVER-29693 wait for all oplog writes to be visible for afterClusterTime and readConcern level local
Branch: master
https://github.com/mongodb/mongo/commit/1602ed3a3b4b101f88be519b13dd69b1c0f04343

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