diff options
author | Judah Schvimer <judah@mongodb.com> | 2018-08-07 13:42:19 -0400 |
---|---|---|
committer | Judah Schvimer <judah@mongodb.com> | 2018-08-07 13:42:19 -0400 |
commit | 0ed9472dc8c2f85e957052f01336b1247c7a6e75 (patch) | |
tree | da761a08d90ca13f535a443447ff790910e34702 /src/mongo/db/repl/oplog.h | |
parent | 3ff467eb73c0db1022ba4e1c182bedf65f183a3b (diff) | |
download | mongo-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.h | 20 |
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 |