diff options
author | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2018-03-15 21:18:19 -0400 |
---|---|---|
committer | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2018-03-15 21:18:19 -0400 |
commit | 8ab8025f23fb50d15336870a6cea4e4ca6f9673a (patch) | |
tree | 3b22cd47318b634ad6c939523cfbc317e3b57a2c /src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h | |
parent | 0abcf8f3cf547327c4dab4aea1ff22e1d75a8db8 (diff) | |
download | mongo-8ab8025f23fb50d15336870a6cea4e4ca6f9673a.tar.gz |
SERVER-33846: Set oplog visibility synchronously on secondaries, at the end of every batch.
This patch introduces an optimization to allow secondaries to set their
visibility synchronously with oplog application as well as bypassing
additional journal flushing meant for primaries. Primaries replicating oplog
entries atomically generate a new optime and pass it to the storage engine's
oplog record store via the `oplogDiskLocRegister` method. This code path
will now pass in a parameter `orderedCommit = false` that alerts the storage
engine to maintain the necessary oplog visibility semantics for that write.
This is existing behavior, the only difference is the addition of the
`orderedCommit` parameter.
Secondaries will now also call `oplogDiskLocRegister` at the end of every
batch. This call will pass in the optime of the last oplog entry applied and
`orderedCommit = true`. A storage engine may take this as a guarantee that
there are no oplog holes prior to the input optime.
Diffstat (limited to 'src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h')
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h index 5207cab95ab..19b110a9f1e 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h @@ -93,6 +93,10 @@ public: void setRollbackWritesDisabled() override {} + virtual void setOrderedCommit(bool orderedCommit) override { + _orderedCommit = orderedCommit; + } + // ---- WT STUFF WiredTigerSession* getSession(); @@ -148,6 +152,9 @@ private: bool _inUnitOfWork; bool _active; bool _isTimestamped = false; + // Commits are assumed ordered. Unordered commits are assumed to always need to reserve a + // new optime, and thus always call oplogDiskLocRegister() on the record store. + bool _orderedCommit = true; Timestamp _commitTimestamp; uint64_t _mySnapshotId; Timestamp _majorityCommittedSnapshot; |