summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/oplog.h
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2018-08-07 13:42:19 -0400
committerJudah Schvimer <judah@mongodb.com>2018-08-07 13:42:19 -0400
commit0ed9472dc8c2f85e957052f01336b1247c7a6e75 (patch)
treeda761a08d90ca13f535a443447ff790910e34702 /src/mongo/db/repl/oplog.h
parent3ff467eb73c0db1022ba4e1c182bedf65f183a3b (diff)
downloadmongo-0ed9472dc8c2f85e957052f01336b1247c7a6e75.tar.gz
SERVER-35798 preallocate prepare timestamp
Diffstat (limited to 'src/mongo/db/repl/oplog.h')
-rw-r--r--src/mongo/db/repl/oplog.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/mongo/db/repl/oplog.h b/src/mongo/db/repl/oplog.h
index b209b695fa3..565ab7f31cb 100644
--- a/src/mongo/db/repl/oplog.h
+++ b/src/mongo/db/repl/oplog.h
@@ -31,6 +31,7 @@
#include <string>
#include <vector>
+#include "mongo/base/shim.h"
#include "mongo/base/status.h"
#include "mongo/bson/bsonobj.h"
#include "mongo/bson/timestamp.h"
@@ -264,11 +265,20 @@ void createIndexForApplyOps(OperationContext* opCtx,
IncrementOpsAppliedStatsFn incrementOpsAppliedStats,
OplogApplication::Mode mode);
-/**
- * Allocates optimes for new entries in the oplog. Returns an OplogSlot or a vector of OplogSlots,
- * which contain the new optimes along with their terms and newly calculated hash fields.
- */
-OplogSlot getNextOpTime(OperationContext* opCtx);
+// Shims currently do not support free functions so we wrap getNextOpTime in a class as a
+// workaround.
+struct GetNextOpTimeClass {
+ /**
+ * Allocates optimes for new entries in the oplog. Returns an OplogSlot or a vector of
+ * OplogSlots, which contain the new optimes along with their terms and newly calculated hash
+ * fields.
+ */
+ static MONGO_DECLARE_SHIM((OperationContext * opCtx)->OplogSlot) getNextOpTime;
+};
+
+inline OplogSlot getNextOpTime(OperationContext* opCtx) {
+ return GetNextOpTimeClass::getNextOpTime(opCtx);
+}
/**
* Allocates an OpTime, but does not update the storage engine with the timestamp. This is used to