summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/storage_interface_impl.cpp
diff options
context:
space:
mode:
authorDaniel Gottlieb <daniel.gottlieb@mongodb.com>2018-03-15 21:18:19 -0400
committerDaniel Gottlieb <daniel.gottlieb@mongodb.com>2018-03-15 21:18:19 -0400
commit8ab8025f23fb50d15336870a6cea4e4ca6f9673a (patch)
tree3b22cd47318b634ad6c939523cfbc317e3b57a2c /src/mongo/db/repl/storage_interface_impl.cpp
parent0abcf8f3cf547327c4dab4aea1ff22e1d75a8db8 (diff)
downloadmongo-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/repl/storage_interface_impl.cpp')
-rw-r--r--src/mongo/db/repl/storage_interface_impl.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/repl/storage_interface_impl.cpp b/src/mongo/db/repl/storage_interface_impl.cpp
index 58a6eaf21f2..71442a94c57 100644
--- a/src/mongo/db/repl/storage_interface_impl.cpp
+++ b/src/mongo/db/repl/storage_interface_impl.cpp
@@ -1096,5 +1096,13 @@ void StorageInterfaceImpl::waitForAllEarlierOplogWritesToBeVisible(OperationCont
oplog.getCollection()->getRecordStore()->waitForAllEarlierOplogWritesToBeVisible(opCtx);
}
+void StorageInterfaceImpl::oplogDiskLocRegister(OperationContext* opCtx,
+ const Timestamp& ts,
+ bool orderedCommit) {
+ AutoGetCollection oplog(opCtx, NamespaceString::kRsOplogNamespace, MODE_IS);
+ fassert(
+ 28557,
+ oplog.getCollection()->getRecordStore()->oplogDiskLocRegister(opCtx, ts, orderedCommit));
+}
} // namespace repl
} // namespace mongo