diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp index a672dfeb78..546016d110 100644 --- a/src/mongo/db/repl/oplog.cpp +++ b/src/mongo/db/repl/oplog.cpp @@ -159,6 +159,13 @@ void _getNextOpTimes(OperationContext* opCtx, term = replCoord->getTerm(); } +#if 1 + { + // XXX hack to move begin_transaction out of lock. + opCtx->recoveryUnit()->ensureSession(); + } +#endif + stdx::lock_guard lk(newOpMutex); auto ts = LogicalClock::get(opCtx)->reserveTicks(count).asTimestamp(); diff --git a/src/mongo/db/storage/recovery_unit.h b/src/mongo/db/storage/recovery_unit.h index fe9ed47316..2e74199f91 100644 --- a/src/mongo/db/storage/recovery_unit.h +++ b/src/mongo/db/storage/recovery_unit.h @@ -71,6 +71,11 @@ public: virtual void abortUnitOfWork() = 0; /** + * Ensure that a session is allocated. + */ + virtual void ensureSession() {}; + + /** * Waits until all commits that happened before this call are durable. Returns true, unless the * storage engine cannot guarantee durability, which should never happen when isDurable() * returned true. This cannot be called from inside a unit of work, and should fail if it is. diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h index 397d17a142..90c060b278 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h @@ -65,6 +65,8 @@ public: void commitUnitOfWork() override; void abortUnitOfWork() override; + void ensureSession() override { (void)getSession(); } + bool waitUntilDurable() override; void registerChange(Change* change) override;