-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Replication
-
None
-
Fully Compatible
-
Repl 2019-12-30, Repl 2020-01-13, Repl 2020-01-27
-
20
It is not valid to call setLastOpToSystemLastOpTime() and then wait for majority writeConcern to ensure that any data read was majority committed. The reason is that writes update the lastApplied in an on-commit hook after the data changes are made. Consider the following scenario. Originally the lastApplied is time 1. Operation A updates the document {_id: 0} to have a=5 and writes an oplog entry with time 2. Operation B reads the document {_id: 0, a: 5}. Operation B calls setLastOpToSystemLastOpTime() and gets the lastApplied time as time 1. Then the on-commit hook for Operation A updates the lastApplied to time 2. Operation B will wait for the majority commit point to reach time 1, which does not guarantee that the data that it read was majority committed.
Any callers of setLastOpToSystemLastOpTime() that use it to ensure data read was majority committed are suspect. This excludes reading transaction state in transaction operations, since they are serialized by the session checkout mechanism, so a new transaction operation cannot start until the on-commit hooks have finished for the previous operation.
- causes
-
SERVER-45800 Unlock RSTL after calling setLastOpToSystemLastOpTime in PrepareTransactionCmd
- Closed
- depends on
-
SERVER-43656 Return the timestamp of the top of the oplog in the storage integration layer
- Closed
- is depended on by
-
SERVER-41165 Transaction participants don't need to do a noop write before committing a read-only transaction
- Backlog
- is related to
-
SERVER-30217 applyOps doesn't wait for replication on the last op if it's a noop
- Backlog
-
SERVER-37948 Linearizable read concern is not satisfied by getMores on a cursor
- Closed
-
SERVER-39356 Change stream updateLookup queries with speculative majority may return uncommitted data
- Closed
-
SERVER-38906 Multi-document transactions should not perform timestamped read ahead of all-committed
- Closed
- related to
-
SERVER-45598 Complete TODO listed in SERVER-39364
- Closed
-
SERVER-44820 bgSync grabs DBLock in X mode when reading the oplog
- Closed