summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/oplog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/repl/oplog.cpp')
-rw-r--r--src/mongo/db/repl/oplog.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp
index b588d7f0adc..b383b1b0565 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -819,6 +819,17 @@ void createOplog(OperationContext* opCtx) {
createOplog(opCtx, localOplogInfo(opCtx->getServiceContext()).oplogName, isReplSet);
}
+MONGO_REGISTER_SHIM(GetNextOpTimeClass::getNextOpTime)(OperationContext* opCtx)->OplogSlot {
+ // The local oplog collection pointer must already be established by this point.
+ // We can't establish it here because that would require locking the local database, which would
+ // be a lock order violation.
+ auto oplog = localOplogInfo(opCtx->getServiceContext()).oplog;
+ invariant(oplog);
+ OplogSlot os;
+ _getNextOpTimes(opCtx, oplog, 1, &os);
+ return os;
+}
+
OplogSlot getNextOpTimeNoPersistForTesting(OperationContext* opCtx) {
auto oplog = localOplogInfo(opCtx->getServiceContext()).oplog;
invariant(oplog);
@@ -828,8 +839,7 @@ OplogSlot getNextOpTimeNoPersistForTesting(OperationContext* opCtx) {
return os;
}
-MONGO_REGISTER_SHIM(GetNextOpTimeClass::getNextOpTimes)
-(OperationContext* opCtx, std::size_t count)->std::vector<OplogSlot> {
+std::vector<OplogSlot> getNextOpTimes(OperationContext* opCtx, std::size_t count) {
// The local oplog collection pointer must already be established by this point.
// We can't establish it here because that would require locking the local database, which would
// be a lock order violation.
@@ -841,6 +851,7 @@ MONGO_REGISTER_SHIM(GetNextOpTimeClass::getNextOpTimes)
return oplogSlots;
}
+
// -------------------------------------
namespace {